[SERVER-4516] findAndModify should tolerate _id in update field if it doesn't modify it Created: 17/Dec/11 Updated: 11/Jul/16 Resolved: 02/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.3 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Vincent Côté-Roy | Assignee: | Scott Hernandez (Inactive) |
| Resolution: | Done | Votes: | 1 |
| Labels: | findAndModify | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
findAndModify currently throws a "Mod on _id not allowed" error if update contains an _id, even when the query would not actually change the _id of the document, or a new document would be created. findAndModify instead should only throw an error if it has ascertained that a matched document has a different _id as the one specified in the query. this applies especially when one uses findAndModify as a way to do a 'save' (ie, an upsert) with a unique key different than _id. in that case the _id would never be changed, but still one is forced to take care of removing the _id from the document when saving it. |
| Comments |
| Comment by Daniel Pasette (Inactive) [ 03/Oct/13 ] | |||||||
|
This appears to be fixed in 2.4.7 already.
| |||||||
| Comment by Scott Hernandez (Inactive) [ 02/Oct/13 ] | |||||||
|
Fixed during the update refactoring in 2.5.3
|