Skip to content

DRIVERS-2975 Fix logic for populating BulkWriteException.partialResult #1665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions source/crud/bulk-write.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,16 @@ The server's response to `bulkWrite` has the following format:
}
```

If any operations were successful (i.e. `nErrors` is less than the number of operations that were sent), drivers MUST
record the summary count fields in a `BulkWriteResult` to be returned to the user or embedded in a `BulkWriteException`.
Drivers MUST NOT populate the `partialResult` field in `BulkWriteException` if no operations were successful.
Drivers MUST record the summary count fields in a `BulkWriteResult` to be returned to the user or embedded in a
`BulkWriteException` if the response indicates that at least one write was successful:

- For ordered bulk writes, at least one write was successful if `nErrors` is 0 or if the `idx` value for the write error
returned in the results cursor is greater than 0.
- For unordered bulk writes, at least one write was successful if `nErrors` is less than the number of operations that
were included in the `bulkWrite` command.

Drivers MUST NOT populate the `partialResult` field in `BulkWriteException` if it cannot be determined that at least one
write was successfully performed.

Drivers MUST attempt to consume the contents of the cursor returned in the server's `bulkWrite` response before
returning to the user. This is required regardless of whether the user requested verbose or summary results, as the
Expand Down Expand Up @@ -859,6 +866,8 @@ batch-splitting to standardize implementations across drivers and simplify batch

## **Changelog**

- 2024-09-25: Update the `partialResult` population logic to account for ordered bulk writes.

- 2024-09-18: Relax numeric type requirements for indexes.

- 2024-05-17: Update specification status to "Accepted".
Expand Down
Loading
Loading