[SERVER-26371] Changes made through `updateOne` in Bulk operations report as nUpserted Created: 28/Sep/16 Updated: 19/Nov/16 Resolved: 19/Nov/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.2.6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Xavier Del Castillo | Assignee: | Kelsey Schubert |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Participants: |
| Description |
|
I'm currently running a bulk operation to rename a property of a subdocument stored in an array. Since it's not possible to do a `$rename` for my use case, I'm doing a bulk operation, however the BulkWriteResult returned seems to be misleading and incorrect - in contrast, the actual update is done properly, however I can't be sure that it was done correctly by just looking at the BulkWriteResult alone. This is a sample document:
And this is my bulk query that attempts to rename the `scheduledAt` property for the subdocument:
And this is my BulkWriteResult:
Which is very misleading, because according to the documentation, nUpserted is set when explicitly using `upsert` which I'm not using, also `nMatched` value is 0, so from this result alone, it seems to me like 2 new documents were upserted as result of the bulk operation. By Inspecting the document that I wanted to update, I can tell that the update was done correctly, also I'm sure it's not upserting documents because the collection count before and after the bulk op doesn't change. |
| Comments |
| Comment by Kelsey Schubert [ 19/Nov/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi xdc, Since we are unable to reproduce this issue and haven't heard back. I am closing this ticket. If this is still an issue for you please provide additional information to help use investigate and we will reopen the ticket. Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kelsey Schubert [ 28/Sep/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi xdc, Thanks for opening this ticket. I'm not seeing the same behavior that you describe on MongoDB 3.2.6, would you please look over the reproduction script below and the resulting output:
After running this I see the following output:
Thank you, |