Class MongoNotConnectedError

An error thrown when the user attempts to operate on a database or collection through a MongoClient that has not yet successfully called the "connect" method当用户试图通过尚未成功调用“connect”方法的MongoClient对数据库或集合进行操作时引发的错误

Hierarchy

Constructors

  • Do not use this constructor!

    Meant for internal use only.仅供内部使用。

    Parameters

    • message: string

    Returns MongoNotConnectedError

    Remarks

    This class is only meant to be constructed within the driver. 这个类只能在驱动程序中构造。This constructor is not subject to semantic versioning compatibility guarantees and may change at any time.此构造函数不受语义版本控制兼容性保证的约束,并且可能随时更改。

Properties

cause?: Error
code?: string | number

This is a number in MongoServerError and a string in MongoDriverError这是MongoServerError中的一个数字,也是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

  • 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如果错误具有提供的错误标签,则返回true

  • Create .stack property on a target object在目标对象上创建.stack属性

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

Generated using TypeDoc