Skip to content

Commit 0615167

Browse files
DRIVERS-2968 Relax index type requirements in bulk write spec (#1661)
1 parent ffa75b4 commit 0615167

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

source/crud/bulk-write.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,17 @@ class BulkWriteResult {
353353
/**
354354
* The results of each individual insert operation that was successfully performed.
355355
*/
356-
insertResults: Map<Int64, InsertOneResult>;
356+
insertResults: Map<Index, InsertOneResult>;
357357

358358
/**
359359
* The results of each individual update operation that was successfully performed.
360360
*/
361-
updateResults: Map<Int64, UpdateResult>;
361+
updateResults: Map<Index, UpdateResult>;
362362

363363
/**
364364
* The results of each individual delete operation that was successfully performed.
365365
*/
366-
deleteResults: Map<Int64, DeleteResult>;
366+
deleteResults: Map<Index, DeleteResult>;
367367
}
368368

369369
class InsertOneResult {
@@ -451,7 +451,7 @@ class BulkWriteException {
451451
* Errors that occurred during the execution of individual write operations. This map will
452452
* contain at most one entry if the bulk write was ordered.
453453
*/
454-
writeErrors: Map<Int64, WriteError>;
454+
writeErrors: Map<Index, WriteError>;
455455

456456
/**
457457
* The results of any successful operations that were performed before the error was
@@ -461,6 +461,13 @@ class BulkWriteException {
461461
}
462462
```
463463

464+
### Index Types
465+
466+
The `insertResults`, `updateResults`, and `deleteResults` maps in `BulkWriteResult` and the `writeErrors` map in
467+
`BulkWriteException` specify `Index` as their key type. This value corresponds to the index of the operation in the
468+
`writeModels` list that was provided to `MongoClient.bulkWrite`. Drivers SHOULD use their language's standard numeric
469+
type for indexes for this type (e.g. `usize` in Rust). If no standard index type exists, drivers MUST use `Int64`.
470+
464471
## Building a `bulkWrite` Command
465472

466473
The `bulkWrite` server command has the following format:
@@ -852,6 +859,8 @@ batch-splitting to standardize implementations across drivers and simplify batch
852859

853860
## **Changelog**
854861

862+
- 2024-09-18: Relax numeric type requirements for indexes.
863+
855864
- 2024-05-17: Update specification status to "Accepted".
856865

857866
- 2024-05-10: Improve rendered format for JSON-like code blocks.

0 commit comments

Comments
 (0)