Class MongoUnexpectedServerResponseError

An error generated when a parsable unexpected response comes from the server. This is generally an error where the driver in a state expecting a certain behavior to occur in the next message from MongoDB but it receives something else. This error does not represent an issue with wire message formatting.

Example

When an operation fails, it is the driver's job to retry it. It must perform serverSelection again to make sure that it attempts the operation against a server in a good state. If server selection returns a server that does not support retryable operations, this error is used. This scenario is unlikely as retryable support would also have been determined on the first attempt but it is possible the state change could report a selectable server that does not support retries.

Hierarchy

Constructors

Properties

cause?: Error
code?: string | number

This is a number in MongoServerError and a string in MongoDriverError

connectionGeneration?: number
message: string
stack?: string
topologyVersion?: TopologyVersion
prepareStackTrace?: ((err, stackTraces) => any)

Type declaration

stackTraceLimit: number

Accessors

  • get errmsg(): string
  • Legacy name for server error responses

    Returns string

  • get errorLabels(): string[]
  • Returns string[]

  • get name(): string
  • Returns string

Methods

  • Parameters

    • label: string

    Returns void

  • Checks the error to see if it has an error label

    Parameters

    • label: string

      The error label to check for

    Returns boolean

    returns true if the error has the provided error label

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function
      Optional

    Returns void

Generated using TypeDoc