Large Collection Updates

I've been reading through and using the ODM functionality and am having an issue with large updates. Following the robot example from the docs, lets say I have a collection with a couple million robots and I need to make a large update. Writing the query in PHP would like:

$db->robots ->update(['type' => 'mechanical'], ['$set' => ['type' => 'electrical']], ['multiple' => true]);

When trying to use the ODM I come up with something like:

$robots = Robots::find(array(
    array("type" => "mechanical")

foreach ($robots as $Robot) {
    $Robot->type = "electrical";

Obviously this is unacceptable due to having to loop through all the Models and make all the extra database calls. What would be the best way to approach having to update large collections. I read through the PHQL documentation but I didn't see any examples of how to work with Mongo. Thanks


If this unacceptable you must consider not using an Object Document Mapper (ODM) and fall back to the basic MongoClient.