Type alias GenericUpdateResult<ID, N>

Overview

Represents the result of a generic update* command performed on the Data API.

🚨Important: The exact result type depends on the upsertedCount field of the result:

Type Parameters

  • ID
  • N extends number

Example

const result = await collection.updateOne(
{ _id: 'abc' },
{ $set: { name: 'John' } },
{ upsert: true },
);

if (result.upsertedCount) {
console.log(`Document with ID ${result.upsertedId} was upserted`);
}

See

  • CollectionUpdateOneResult
  • CollectionUpdateManyResult