Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
None
Description
http://docs.mongodb.org/manual/release-notes/2.2/#findandmodify-returns-null
http://docs.mongodb.org/manual/reference/command/findAndModify/
Behavior outlined is incorrect... claims null returned always (or the odd ok: 1.0 hash), but this isn't the case and the correct behavior is more akin to what one would expect.
> db.t.findAndModify({query:
{name: "Steve"}, upsert: true, update: {name: "John"}})
null
> db.t.findAndModify({query:
, upsert: true, update: {name: "Johnny"}})
{ "_id" : ObjectId("50eb188773015b3832f64dda"), "name" : "John" }> db.t.findAndModify({query:
{name: "Tyler"}, new: true, upsert: true, update: {name: "Johnny"}})
{ "_id" : ObjectId("50eb18e473015b3832f64ddc"), "name" : "Johnny" }>