-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
Currently, Collection.InsertMany accepts a []interface for the list of documents to insert. However, that API often requires users to copy their existing slice of documents to a slice of type []interface, adding unnecessary repeated code and unnecessary data copies. Improve the API by changing the documents parameter type to interface and use reflection to require users to pass in a array type (i.e. array or slice).
This ticket was created based on a proposed improvement in a community PR.
Definition of done:
- Change the documents parameter in InsertMany to any instead of []any.
- Return an error if the value passed to the documents parameter is not a slice. That avoids ambiguity between inserting many documents and inserting a single document that is an array.
- Add an InsertMany benchmark and compare the performance before/after. Require that there is no significant performance impact.
- is related to
-
GODRIVER-3026 Optimize Collection.insert()
- Backlog