Interface GenericInsertManyUnorderedOptions

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 table.insertMany([
{ id: uuid.v4(), name: 'John' },
{ id: uuid.v7(), name: 'Jane' },
], {
concurrency: 16, // ordered implicitly `false` if unset
});

See

GenericInsertManyOptions

interface GenericInsertManyUnorderedOptions {
    chunkSize?: number;
    concurrency?: 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?: false;
    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">
    • GenericInsertManyUnorderedOptions

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
concurrency?: number

The maximum number of concurrent requests to make at once.

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?: false

If false, the records are inserted in an arbitrary order. If an error occurs, the operation does not stop and the remaining records are inserted. This allows the operation to be parallelized for better performance.

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.