Interface GenericUpdateOneOptions

Options for a generic updateOne command using the Data API.

Field

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

Field

sort - The sort order to pick which document to update if the filter selects multiple documents.

Field

timeout - The timeout override for this method

interface GenericUpdateOneOptions {
    sort?: Sort;
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "generalMethodTimeoutMs">;
    upsert?: boolean;
}

Hierarchy (view full)

  • WithTimeout<"generalMethodTimeoutMs">
    • GenericUpdateOneOptions

Properties

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