Class CollectionUpdateManyError

Overview

Represents an error that occurred during an updateMany operation (which is, generally, paginated).

Contains the number of documents that were successfully matched and/or modified, as well as the cumulative errors that occurred during the operation.

Example

try {
await collection.updateMany({ age: 30 }, { $inc: { age: 1 } });
} catch (e) {
if (e instanceof CollectionUpdateManyError) {
console.log(e.cause);
console.log(e.partialResult);
}
}

See

Collection.updateMany

Hierarchy (view full)

Constructors

Properties

cause: Error

The error that caused the operation to fail.

message: string
name: string = 'CollectionUpdateManyError'

The name of the error. This is always 'UpdateManyError'.

The partial result of the UpdateMany operation that was performed. This is always defined, and is the result of the operation up to the point of the first error.

stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

Type declaration

    • (err, stackTraces): any
    • Parameters

      • err: Error
      • stackTraces: CallSite[]

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void