Interface InsertManyOrderedOptions

Options for insertMany when ordered is true.

Field

ordered - If true, the documents are inserted sequentially in the order provided.

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

interface InsertManyOrderedOptions {
    chunkSize?: number;
    maxTimeMS?: number;
    ordered: true;
    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
maxTimeMS?: number

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

ordered: true

If true, the documents are inserted in the order provided. If an error occurs, the operation stops and the remaining documents are not inserted.

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

Akin to InsertManyOrderedOptions.vectors, but for $vectorize. * *

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