[SERVER-7379] Immutable shardkey becomes mutable Created: 17/Oct/12 Updated: 11/Jul/16 Resolved: 11/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding, Write Ops |
| Affects Version/s: | 2.2.0 |
| Fix Version/s: | 2.5.3 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Kay Agahd | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
linux 64 bit |
||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | Linux | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
I'm using the following shard key {"categoryId":1, "store":1, "_id":1}For testing purposes I only have one document in the collection:
When I want to update a field, I get correctly an alert "Can't modify shard key's value":
However, I can modify the shard key by executing this:
Also, I could call save to change the shard key again (back):
Now, when I try to add a second shard key field to the query, I get the same but differently expressed correct alert:
However, when I replace the second by the third shard key field in the query, the update works again:
I asked already in the mongoDB forum but nobody answered so far. As I think that's rather a bug than a feature, I opened this bug report. |
| Comments |
| Comment by Githook User [ 26/Feb/14 ] | ||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: | ||||
| Comment by Scott Hernandez (Inactive) [ 18/Oct/13 ] | ||||
|
Commit: https://github.com/mongodb/mongo/commit/bfead9163f1cd1ca06d7c358a93fedbe48e9f512 | ||||
| Comment by auto [ 10/Oct/13 ] | ||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}Message: | ||||
| Comment by auto [ 10/Oct/13 ] | ||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}Message: | ||||
| Comment by auto [ 02/Jul/13 ] | ||||
|
Author: {u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}Message: Added test cases (commented out currently failing ones). | ||||
| Comment by Scott Hernandez (Inactive) [ 21/Feb/13 ] | ||||
|
The new $setOnInsert now becomes a logical $set if the result is an insert. | ||||
| Comment by Randolph Tan [ 21/Dec/12 ] | ||||
|
Passes through a different code path compared to
This is because mongos doesn't know whether doc that matches { x: 1 }exists or not. In other words, if this is actually an upsert, then this should be allowed, but if not, then not allowed. But mongos can't tell whether this will end up as a normal update or upsert. | ||||
| Comment by Randolph Tan [ 17/Oct/12 ] | ||||
|
Fully reproducible, with slightly different (worse) outcome in the latest version (git 823da97015a5bc950708ff5c565583cc0c6ea25b): 1. update fails silently (even gle gives you nothing) on this case:
2. There is now no warning for this case and the shard key values will be modified!
|