Interface GenericUpdateOneOptions

Overview

The options for a generic updateOne command performed on the Data API.

Example

const result = await collection.updateOne(
{ name: 'John' },
{ $set: { dob: new Date('1990-01-01'), updatedAt: { $currentDate: true } } },
{ upsert: true, sort: { $vector: [...] } },
);

See

  • CollectionUpdateOneOptions
  • TableUpdateOneOptions
interface GenericUpdateOneOptions {
    maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using `timeout`";
    sort?: Sort;
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "generalMethodTimeoutMs">;
    upsert?: boolean;
    vector?: "ERROR: Use `sort: { $vector: [...] }` instead";
    vectorize?: "ERROR: Use `sort: { $vectorize: \"...\" }` instead";
}

Hierarchy (view full)

  • WithTimeout<"generalMethodTimeoutMs">
    • GenericUpdateOneOptions

Properties

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.
sort?: Sort

The order in which to apply the update if the filter selects multiple documents.

If multiple documents match the filter, only one will be updated.

Defaults to null, where the order is not guaranteed.

Default Value

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

The method timeout override.

See TimeoutDescriptor for much more information.

upsert?: boolean

If true, perform an insert if no documents match the filter.

If false, do not insert if no documents match the filter.

Defaults to false.

Default Value

false
vector?: "ERROR: Use `sort: { $vector: [...] }` instead"

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

Deprecated

  • Use sort: { $vector: [...] } instead.
vectorize?: "ERROR: Use `sort: { $vectorize: \"...\" }` instead"

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

Deprecated

  • Use sort: { $vectorize: '...' } instead.