[SERVER-3940] Passing a complete document to update can break shard key immutability. Created: 24/Sep/11 Updated: 11/Jul/16 Resolved: 17/Jan/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 1.8.2, 2.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Bernie Hackett | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
Shard keys are supposed to be immutable. This is enforced during update when using an update modifier like $set but not when passing an entire document: mongos> db.runCommand({shardcollection: 'foo.things', key: {'foobar': 1}, unique: true}) { "collectionsharded" : "foo.things", "ok" : 1 }... mongos> db.things.update( {'foobar': 123}, {'$set': {'foobar': 456}}) mongos> doc.foobar = 456 See the attached js for an example using update directly (without upsert). |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 17/Jan/13 ] |
|
There is a related case not fully fixed yet: |
| Comment by Eliot Horowitz (Inactive) [ 17/Jan/13 ] |
|
this was fixed, just can't remember the ticket |