Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-656

Wrong error index with bulk write commands

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Bulk API, libmongoc
    • None

      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.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: