Is there a way to do atomic "find one and update"? #397
Unanswered
kschniedergers
asked this question in
Question
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am looking for functionality to do mongos findOneAndUpdate (https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndUpdate), which I need for cuncurrency reasons. Mongo's findOneAndUpdate find and updates in one step, so you don't need to worry about another thread updating data between another threads find and update.
If i understand correctly, when doing something like Object.find(...).update_one(...), the find and update are separate so other threads could mess with things if they update data between the find and update
Beta Was this translation helpful? Give feedback.
All reactions