Interface InsertManyUnorderedOptions

Options for insertMany when ordered is false.

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

vectors - A list of optional vectors to use for the documents, if using a vector-enabled collection.

See

Collection.insertMany

interface InsertManyUnorderedOptions {
    chunkSize?: number;
    concurrency?: number;
    maxTimeMS?: number;
    ordered?: false;
    vectorize?: (undefined | null | string)[];
    vectors?: (undefined | null | number[])[];
}

Hierarchy (view full)

Properties

chunkSize?: number

The 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.

Default Value

20
concurrency?: number

The maximum number of concurrent requests to make at once.

maxTimeMS?: number

The maximum time to wait for a response from the server, in milliseconds.

ordered?: false

If 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.

vectorize?: (undefined | null | string)[]

NOTE: This feature is under current development.

Deprecated

  • Prefer to set the $vectorize fields in the docs directly
vectors?: (undefined | null | number[])[]

A 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.

Deprecated

  • Prefer to set the $vector fields in the docs directly