mongodb c# API V2: Difference between ReplaceOne a

2019-07-16 21:30发布

问题:

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