Optional
chunkThe number of documents to upload per request. Defaults to 20.
If you have large documents, you may find it beneficial to reduce this number and increase concurrency to improve throughput. Leave it unspecified (recommended) to use the system default.
20
Optional
concurrencyThe maximum number of concurrent requests to make at once.
Optional
maxThe maximum time to wait for a response from the server, in milliseconds.
Optional
orderedIf false
, the documents are inserted in an arbitrary order. If an error occurs, the operation does not stop
and the remaining documents are inserted. This allows the operation to be parallelized for better performance.
Optional
vectorizeAkin to InsertManyUnorderedOptions.vectors, but for $vectorize
.
$vectorize
fields in the docs directlyOptional
vectorsA list of optional vectors to use for the documents, if using a vector-enabled collection.
This is purely for the user's convenience and intuitiveness—it is equivalent to setting the $vector
field on the
documents themselves. The two are interchangeable, but mutually exclusive.
The list may contain null
or undefined
values, which mark the corresponding document as not having a vector
(or the doc having its $vector
field already set).
NB. Setting this field will cause a shallow copy of the documents to be made for non-null vectors. If
performance is a concern, it is recommended to directly set the $vector
field on the document itself.
If any document already has a $vector
field, and this is set, the $vector
field will be overwritten. It is
up to the user to ensure that both fields are not set at once.
$vector
fields in the docs directly
Options for insertMany when
ordered
isfalse
.Field
ordered - If
false
or unset, the documents are inserted in an arbitrary, parallelized order.Field
concurrency - The maximum number of concurrent requests to make at once.
Field
chunkSize - The number of documents to upload per request. Defaults to 20.
Field
maxTimeMS - The maximum time to wait for a response from the server, in milliseconds.
See
Collection.insertMany