Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-74390

Add numErrors to bulkWrite command responses

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Replication
    • Fully Compatible
    • Repl 2023-04-17, Repl 2023-05-01

      The bulkWrite command should return an numErrors field indicating the number of errors in its cursor response. So this will look something like:

      {
          ok: 1,
          numErrors: NumberInt(...),
          cursor: {
              id: NumberLong(...),
              firstBatch: [
                  { ok: 1, idx: 0, n: NumberInt(...), nModified: NumberInt(...), upserted: any, value: { ... } },
                  { ok: 0, idx: 1, code: NumberInt(...), codeName: " ... ", errmsg: " ... " },
                  ...
              ]
          },
          ...
      }
      

      Based on the numErrors, users can decide if they would like to iterate through the cursor responses to consume the response for each individual operation. If the users/drivers decide not to exhaust the returned cursor, it is expected that a killCursors command is sent to kill the cursor on the server side.

       

      Note this ticket also covers updating existing tests in jstests/core/write/bulk/bulk_write_*_cursor.js to properly test the number of errors returned and add any new required tests to cover multiple errors being counted correctly.

            Assignee:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Reporter:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: