Type alias CollectionUpdateManyResult<RSchema>

CollectionUpdateManyResult<RSchema>: GenericUpdateResult<IdOf<RSchema>, number>

Represents the result of an updateMany command on a collection.

Type Parameters

  • RSchema

Example

const result = await collections.updateMany({
  name: 'Jane',
}, {
  $set: { name: 'John' }
}, {
  upsert: true
});

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

Field

matchedCount - The number of documents that matched the filter.

Field

modifiedCount - The number of documents that were actually modified.

Field

upsertedCount - The number of documents that were upserted.

Field

upsertedId - The identifier of the upserted document if upsertedCount > 0.

See

Collection.updateMany