-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
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.
- is related to
-
SERVER-76267 Populate numErrors in mongos command response
- Closed