[SERVER-12316] Bulk API downconversion does not return upsertedId with non-ObjectID _id Created: 10/Jan/14 Updated: 10/Dec/14 Resolved: 22/Jan/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Christian Amor Kvalheim | Assignee: | Randolph Tan |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | 26qa | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||
| Description |
|
When you perform an upsert with a custom _id the upserted field is not returned by GLE meaning the bulk api does not register it correctly as a upsert. Beneath is the node.js test that replicates this behavior |
| Comments |
| Comment by Daniel Pasette (Inactive) [ 22/Jan/14 ] | ||||||||||||
|
After discussing with renctan and greg_10gen, there is no way to fix this in 2.5.x alone. This is issue is only present when connecting to a 2.4 mongod from a 2.6 mongo shell using the bulk API when doing an upsert on a non-ObjectID _id field and the impact is that the "upsertedId" is blank. | ||||||||||||
| Comment by Christian Amor Kvalheim [ 14/Jan/14 ] | ||||||||||||
|
You are probably right about that but we have to at least detect the situation where updatedExisting == false and no upserted is in the GLE and update the nModified and nUpserted counts. | ||||||||||||
| Comment by Randolph Tan [ 13/Jan/14 ] | ||||||||||||
|
Not sure if we want to go to that path. On the side note, the above patch does not cover cases where: 1. _id is in update doc:
2. _id is in $mod
| ||||||||||||
| Comment by Christian Amor Kvalheim [ 13/Jan/14 ] | ||||||||||||
|
behavior can be emulated in the bulk api and it's what the node driver is doing. it uses the original op's _id field and returns it to emulate write commands for 2.4.
| ||||||||||||
| Comment by Randolph Tan [ 13/Jan/14 ] | ||||||||||||
|
This is a bug in v2.4 and is caused by: https://github.com/mongodb/mongo/blob/r2.4.9/src/mongo/db/ops/update.h#L39-41 Furthermore, the LastError struct does not support storing non OID _id. Just to clarify, this is only an issue when calling getLastError on mongod v2.4 and below. |