I have a code similar to
db.myColletion.update({'_id':ObjectId("...")}, {'$set': {'state': 'CA'}})
Is above an atomic operation?
Do I need to use findAndModify even on single document for atomicity??
I have a code similar to
db.myColletion.update({'_id':ObjectId("...")}, {'$set': {'state': 'CA'}})
Is above an atomic operation?
Do I need to use findAndModify even on single document for atomicity??
See the docs for findAndModify, specifically the section on comparisons with the update method.
When modifying a single document, both findAndModify and the update() method atomically update the document.