[SERVER-14593] Empty update deletes a record Created: 17/Jul/14 Updated: 17/Jul/14 Resolved: 17/Jul/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 2.6.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aaron Westendorf | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL | |||
| Steps To Reproduce: | Start with a record:
Call update on the collection (this example is in python)
Observe that the record has now been cleared.
The expected behavior is that this is treated as a no-op. |
|||
| Participants: |
| Description |
|
mongo 2.6.1 Calling Collection.update with an empty dictionary will delete all but the _id field. |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 17/Jul/14 ] |
|
This is how replacement style updates work. http://docs.mongodb.org/manual/reference/method/db.collection.update/#replace-a-document-entirely Since the _id field is immutable and cannot be removed it is the only one left after replacing the document. |