What I want to do is update multiple documents with different values in 1 query if possible.
for example my documents may look like:
1:
{
"key": 123,
"price": 10,
}
2:
{
"key": 1234,
"price": 15,
}
…
Then I have a form to update the price, Maybe I want to change #1 to 15 and #2 to 400 in 1 query etc..
Previously I had done multi updates like so:
$db->update('items', array('key' -> array('$in' => $items_to_update)), array('$inc' => array('price' => 1))
Which worked great for updating multiple documents and setting the field to the same value, but I’m not sure how to update multiple documents and updating the value to different values.
From the MongoDB Docs (http://www.mongodb.org/display/DOCS/Atomic+Operations#AtomicOperations-ApplyingtoMultipleObjectsAtOnce):