-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
In the v2.2 shell, update()'s third argument can be a document, in which case the fields in the document specify whether to do upsert or multi. These should be doc'd here:
http://docs.mongodb.org/manual/reference/method/db.collection.update/
Examples:
// Do an upsert. db.foo.update( {name:"Smith"}, {$set:{age:30}}, {upsert:true}) // Do a multi-update db.foo.update( {age:{$lt:30}}, {$inc:{salary:10000}}, {multi:true});
This new API is considerably easier to present to people and slightly less error prone than the pre-v2.2 optional-positional-boolean interface.