[SERVER-12329] UpdatedExisting always true after update command Created: 10/Jan/14 Updated: 25/May/22 Resolved: 15/Jan/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 2.5.4 |
| Fix Version/s: | 2.5.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Bernie Hackett | Assignee: | Randolph Tan |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
getLastError appears to always return true for updatedExisting when the last operation was an update, regardless of whether a document was updated or not.
|
| Comments |
| Comment by Samuel Cadieux [ 25/May/22 ] |
|
I've noticed a similar issue on 5.0.6 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
I've created this issue to track this issue independently: https://jira.mongodb.org/browse/SERVER-66740 |
| Comment by Githook User [ 15/Jan/14 ] |
|
Author: {u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}Message: |