-
Type: Task
-
Resolution: Duplicate
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Go Drivers
Context
The mongo go driver has a method BulkWrite for executing bulkwrite operations as mentioned in the [documentation|https://www.mongodb.com/docs/drivers/go/current/usage-examples/bulkWrite/.] The BulkWrite method accepts a "WriteModel", which is implemented by "UpdateOneModel" and "InsertOneModel". However, when I pass an array of "InsertOneModel" into BulkWrite, it does not offer any "InsertedIDs" property to be able to access the IDs of what was inserted. (There is an "upsertedIDs" property, but it is empty when using InsertOneModels within bulkWrite)
This is odd since the standard mongosh command does allow accessing the insertedIds from the response of BulkWrite (see first example in the documentation), so it looks like the Mongo driver's BulkWrite method is missing an option that should be returned by default.
Definition of done
What must be done to consider the task complete?
- The "InsertedIDs" option should be made available on the mongo.BulkWriteResult struct
- The InsertedIDs should be populated with ids that bulkWrite inserted from the execution of "InsertOneModel" provided in the arguments
Pitfalls
What should the implementer watch out for? What are the risks?
- duplicates
-
GODRIVER-2388 Improved Bulk Write API
- In Progress