Interface GenericInsertManyOrderedOptions

Overview

The options for a generic insertMany command performed on the Data API when ordered is true.

🚨Important: The options depend on the ordered parameter. If ordered is true, then the concurrency option is not allowed.

Example

const result = await collection.insertMany([
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 },
], {
ordered: true,
timeout: 60000,
});

See

GenericInsertManyOptions

interface GenericInsertManyOrderedOptions {
    chunkSize?: number;
    maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using `timeout`";
    ordered: true;
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "generalMethodTimeoutMs">;
    vector?: "ERROR: Set the `$vector` field in the docs directly";
    vectorize?: "ERROR: Set the `$vectorize` field in the docs directly";
}

Hierarchy (view full)

  • WithTimeout<"generalMethodTimeoutMs">
    • GenericInsertManyOrderedOptions

Properties

chunkSize?: number

The number of records to upload per request. Defaults to 50.

If you have large records, 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

50
maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using `timeout`"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • The maxTimeMS option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using timeout, and defaults in timeoutDefaults. You may generally Ctrl+R replace maxTimeMS with timeout to retain the same behavior.
ordered: true

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

timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "generalMethodTimeoutMs">

The method timeout override.

See TimeoutDescriptor for much more information.

vector?: "ERROR: Set the `$vector` field in the docs directly"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • Set the $vector field in the docs directly.
vectorize?: "ERROR: Set the `$vectorize` field in the docs directly"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • Set the $vectorize field in the docs directly.