Looking a the mongodb documentation I read that FindOneAndReplace would be an ATOMIC operation. But what I don't understand is why ReplaceOne wouldn't be atomic? And if there is a difference why should one use ReplaceOne at all?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I just found the answer here, which should be the same for replace.
https://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/#comparisons-with-the-update-method