Reputation: 68720
db.so.insert({"name":"Bob", "sex": "Male", "location": "France"})
db.so.update({"name":"Bob"}, // search
{"name":"Bob", "occupation":"The Builder"}) // replace
I need to do a full update, ie. replace the entire document with the new object, but in this case the sex
and location
fields remain since I'm not providing those fields in the update query.
Upvotes: 1
Views: 108
Reputation: 75964
May be you can try findAndReplace if your intention was to replace the document.
Upvotes: 2