[SERVER-14024] Update fails when query contains part of a DBRef and results in an insert (upsert:true) Created: 21/May/14 Updated: 09/Nov/16 Resolved: 17/Jul/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 2.6.0 |
| Fix Version/s: | 2.6.4, 2.7.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | John Mullanaphy | Assignee: | Scott Hernandez (Inactive) |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Operating System: | ALL | ||||
| Backport Completed: | |||||
| Steps To Reproduce: | Run the second query, seems and "*.$id" upsert fails. |
||||
| Participants: | |||||
| Description |
| Comments |
| Comment by Chris Levy [ 09/Nov/16 ] | ||||||||||||||
|
My apologies there is no confusion on your part but only mine, thanks for the help. | ||||||||||||||
| Comment by Chris Levy [ 09/Nov/16 ] | ||||||||||||||
|
Hi Dave, thanks for your reply, I think you are confusing the "match" part of the update with the "update" part, however you are correct in that this is working fine, I think I made a mistake in picking my fields, I now have this working ok. | ||||||||||||||
| Comment by David Storch [ 08/Nov/16 ] | ||||||||||||||
|
Hi clevy, I believe that the behavior you pointed out is working as designed. If the update were to succeed and perform an insert, it would result in a document like the following:
This is an illegal DBRef, since the $id field is not preceded by $ref. This is different from the case originally reported here; in that case, the upsert resulted in a perfectly valid DBRef, but was nevertheless rejected by the update subsystem's validation code. I hope this explanation makes sense. If you believe that my "works as designed" assessment is not correct, please open a new SERVER ticket reporting the bug and we will investigate and triage by our regular process. Best, | ||||||||||||||
| Comment by Chris Levy [ 01/Nov/16 ] | ||||||||||||||
|
This issue appears to be back in version 2.6.12 :-
results in
| ||||||||||||||
| Comment by Githook User [ 17/Jul/14 ] | ||||||||||||||
|
Author: {u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}Message: Conflicts: | ||||||||||||||
| Comment by Githook User [ 17/Jul/14 ] | ||||||||||||||
|
Author: {u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}Message: | ||||||||||||||
| Comment by Scott Hernandez (Inactive) [ 27/Jun/14 ] | ||||||||||||||
|
Kiril, it is marked for back-port consideration on the next 2.6.x release, once we get it committed to master of course. Ben, yes, it covers that case too. | ||||||||||||||
| Comment by Kiril Savino [ 27/Jun/14 ] | ||||||||||||||
|
Any way this will get back-ported to 2.6? It's going to be blocking upgrade for us. | ||||||||||||||
| Comment by Ben Yelsey [ 27/Jun/14 ] | ||||||||||||||
|
Hi,
We also get a similar error if we replace $id with $ref. Any idea when we can expect a fix? | ||||||||||||||
| Comment by John Mullanaphy [ 23/May/14 ] | ||||||||||||||
|
Excellent and good to hear. I'll keep watching it although as of right now it isn't affecting me, since I'm doing a find then update/insert instead of the upsert. Anyone using Doctrine's ODM can possibly be affected by this as they rely heavily on the "field.$id" for references and not even realize it. So, thanks again and I'll keep an eye on this. | ||||||||||||||
| Comment by Thomas Rueckstiess [ 23/May/14 ] | ||||||||||||||
|
Hi John, Thanks for reporting the issue. We can reproduce this behavior and are investigating. You can watch this ticket for progress on the issue. Regards, | ||||||||||||||
| Comment by John Mullanaphy [ 22/May/14 ] | ||||||||||||||
|
Seems that on the update if the document doesn't exist it fails because of the find the config.$id makes the update sad and it's not due to the value itself, whether that part of the DBRef is an ObjectId or a string _id. |