[SERVER-11285] $set issue: have conflicting mods in update Created: 21/Oct/13 Updated: 16/Nov/15 Resolved: 21/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.4.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Abhishek Kumar | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
x86_64 GNU/Linux |
||
| Issue Links: |
|
||||||||
| Operating System: | Linux | ||||||||
| Steps To Reproduce: | Mongo > db.test1.insert( { a : 1 }) , {$set: { 'b.c': 1, 'b.c.a': 1 }}) |
||||||||
| Participants: | |||||||||
| Description |
|
In the update operation if one of the updated key is prefix of any other updated key, I am getting "have conflicting mods in update" error. We are facing issue in our production system. Can someone throw some light if this is an expected behavior or there is some issue? |
| Comments |
| Comment by Abhishek Kumar [ 21/Oct/13 ] |
|
Thanks, it was helpful |
| Comment by Scott Hernandez (Inactive) [ 21/Oct/13 ] |
|
This is expected behavior. You cannot do an update where more than one modification shares a (path) prefix. The main reason for this is because the order of the modification is not defined (since most languages don't use an ordered dictionary/map – esp. not by default) and the result of applying "b.c" before "b.c.a" will be different than the reverse order and that is not good to have update result being undefined and different depending on the client/tool. |
| Comment by Abhishek Kumar [ 21/Oct/13 ] |
|
The above update example is not correct. Consider the following update operation instead of the above one: , {$set: { 'b.c': { }, 'b.c.a': 1 }}) |