Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Connection

internal

Hierarchy

Index

Constructors

constructor

Events

Static Readonly CLOSE

CLOSE: "close" = ...

Static Readonly CLUSTER_TIME_RECEIVED

CLUSTER_TIME_RECEIVED: "clusterTimeReceived" = ...

Static Readonly COMMAND_FAILED

COMMAND_FAILED: "commandFailed" = ...

Static Readonly COMMAND_STARTED

COMMAND_STARTED: "commandStarted" = ...

Static Readonly COMMAND_SUCCEEDED

COMMAND_SUCCEEDED: "commandSucceeded" = ...

Static Readonly MESSAGE

MESSAGE: "message" = ...

Properties

[kClusterTime]

[kClusterTime]: Document
internal

[kDescription]

[kDescription]: StreamDescription
internal

[kGeneration]

[kGeneration]: number
internal

[kIsMaster]

[kIsMaster]: Document
internal

[kLastUseTime]

[kLastUseTime]: number
internal

[kMessageStream]

[kMessageStream]: MessageStream
internal

[kQueue]

[kQueue]: Map<number, OperationDescription>
internal

[kStream]

[kStream]: Stream
internal

address

address: string

closed

closed: boolean

destroyed

destroyed: boolean

Optional helloOk

helloOk: boolean

id

id: number | "<monitor>"

Optional lastIsMasterMS

lastIsMasterMS: number

monitorCommands

monitorCommands: boolean

Optional serverApi

serverApi: ServerApi

socketTimeoutMS

socketTimeoutMS: number

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Accessors

clusterTime

description

generation

  • get generation(): number

idleTime

  • get idleTime(): number

ismaster

stream

Methods

addListener

command

destroy

emit

  • emit<EventKey>(event: symbol | EventKey, ...args: Parameters<ConnectionEvents[EventKey]>): boolean

eventNames

  • eventNames(): string[]

getMaxListeners

  • getMaxListeners(): number

getMore

handleIssue

  • handleIssue(issue: { destroy?: boolean | Error; isClose?: boolean; isTimeout?: boolean }): void
  • Parameters

    • issue: { destroy?: boolean | Error; isClose?: boolean; isTimeout?: boolean }
      • Optional destroy?: boolean | Error
      • Optional isClose?: boolean
      • Optional isTimeout?: boolean

    Returns void

killCursors

listenerCount

  • listenerCount<EventKey>(type: string | symbol | EventKey): number

listeners

  • listeners<EventKey>(event: string | symbol | EventKey): ConnectionEvents[EventKey][]

markAvailable

  • markAvailable(): void

off

on

once

prependListener

prependOnceListener

query

rawListeners

  • rawListeners<EventKey>(event: string | symbol | EventKey): ConnectionEvents[EventKey][]

removeAllListeners

  • removeAllListeners<EventKey>(event?: string | symbol | EventKey): Connection

removeListener

setMaxListeners

Static getEventListener

  • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
  • Returns a list listener for a specific emitter event name.

    Parameters

    • emitter: DOMEventTarget | EventEmitter
    • name: string | symbol

    Returns Function[]

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Generated using TypeDoc