Skip to content

Commit

Permalink
DRIVERS-2968 Relax index type requirements in bulk write spec (#1661)
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelatkinson committed Sep 18, 2024
1 parent ffa75b4 commit 0615167
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions source/crud/bulk-write.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,17 @@ class BulkWriteResult {
/**
* The results of each individual insert operation that was successfully performed.
*/
insertResults: Map<Int64, InsertOneResult>;
insertResults: Map<Index, InsertOneResult>;

/**
* The results of each individual update operation that was successfully performed.
*/
updateResults: Map<Int64, UpdateResult>;
updateResults: Map<Index, UpdateResult>;

/**
* The results of each individual delete operation that was successfully performed.
*/
deleteResults: Map<Int64, DeleteResult>;
deleteResults: Map<Index, DeleteResult>;
}

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

/**
* The results of any successful operations that were performed before the error was
Expand All @@ -461,6 +461,13 @@ class BulkWriteException {
}
```

### Index Types

The `insertResults`, `updateResults`, and `deleteResults` maps in `BulkWriteResult` and the `writeErrors` map in
`BulkWriteException` specify `Index` as their key type. This value corresponds to the index of the operation in the
`writeModels` list that was provided to `MongoClient.bulkWrite`. Drivers SHOULD use their language's standard numeric
type for indexes for this type (e.g. `usize` in Rust). If no standard index type exists, drivers MUST use `Int64`.

## Building a `bulkWrite` Command

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

## **Changelog**

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

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

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

0 comments on commit 0615167

Please sign in to comment.