-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 5.0.6
-
Component/s: None
-
None
-
ALL
-
I've noticed an issue with findAndModify, where updatedExisting always return true when updating a field with the same value.
I found this blog post that describe the issue well: https://codehunter.cc/a/mongodb/findandupdate-how-to-check-if-document-was-really-updated
Although this behavior seems to be a bug, it's in line with the documention: https://www.mongodb.com/docs/manual/reference/command/findAndModify/#lasterrorobject
However, I would expect updatedExisting to be true if the document was upserted or if any modification was done to the existing document. Similar to how the update command output: https://www.mongodb.com/docs/manual/reference/command/update/#mongodb-data-update.nModified
Might be related to this other issue: https://jira.mongodb.org/browse/SERVER-12329
- duplicates
-
SERVER-28145 add ability to obtain modified flag from findOneAndUpdate result
- Backlog
- is related to
-
SERVER-28145 add ability to obtain modified flag from findOneAndUpdate result
- Backlog