-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Write Ops
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.
- related to
-
SERVER-14286 Additional tests for updates and findAndModifys that touch _id
- Closed