[CDRIVER-656] Wrong error index with bulk write commands Created: 15/May/15  Updated: 03/May/17  Resolved: 16/Jun/15

Status: Closed
Project: C Driver
Component/s: Bulk API, libmongoc
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

With a unique index on "a", do two operations in an ordered mongoc_bulk_operation_t:

  • insert {"a": 1}
  • upsert with selector {"b": 2} and update-document {"$set": {"a": 1}}

The second operation fails because it violates the unique constraint on "a". When mongoc_bulk_operation_execute uses OP_INSERT and OP_UPDATE it correctly fills the reply with:

writeErrors: {[index: 1, code: 11000, errmsg: "E11000 duplicate key error"]}

But if the bulk operation uses write commands, the error index is 0.



 Comments   
Comment by Githook User [ 16/Jun/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: refactor write commands

Send insert, update, and delete commands with the same function.

CDRIVER-648, CDRIVER-654, and CDRIVER-656 are resolved in this commit
or recent commits.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/45cb98a160e17cbec4bb7a5a31a46722a87641e6

Generated at Wed Feb 07 21:10:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.