Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Topology

A container of server instances representing a connection to a MongoDB topology.

internal

Hierarchy

Index

Constructors

constructor

Events

Static Readonly CLOSE

CLOSE: "close" = ...

Static Readonly CONNECT

CONNECT: "connect" = ...

Static Readonly ERROR

ERROR: "error" = ...

Static Readonly OPEN

OPEN: "open" = ...

Static Readonly SERVER_CLOSED

SERVER_CLOSED: "serverClosed" = ...

Static Readonly SERVER_DESCRIPTION_CHANGED

SERVER_DESCRIPTION_CHANGED: "serverDescriptionChanged" = ...

Static Readonly SERVER_OPENING

SERVER_OPENING: "serverOpening" = ...

Static Readonly TIMEOUT

TIMEOUT: "timeout" = ...

Static Readonly TOPOLOGY_CLOSED

TOPOLOGY_CLOSED: "topologyClosed" = ...

Static Readonly TOPOLOGY_DESCRIPTION_CHANGED

TOPOLOGY_DESCRIPTION_CHANGED: "topologyDescriptionChanged" = ...

Static Readonly TOPOLOGY_OPENING

TOPOLOGY_OPENING: "topologyOpening" = ...

Properties

[kWaitQueue]

[kWaitQueue]: Denque<ServerSelectionRequest>
internal

Optional _type

_type: string
internal

bson

bson: { deserialize: (buffer: Buffer | ArrayBufferView | ArrayBuffer, options?: DeserializeOptions) => Document; serialize: (object: Document, options?: SerializeOptions) => Buffer }
internal
privateremarks

mongodb-client-encryption's class ClientEncryption falls back to finding the bson lib defined on client.topology.bson, in order to maintain compatibility with any version of mongodb-client-encryption we keep a reference to serialize and deserialize here.

Type declaration

  • deserialize: (buffer: Buffer | ArrayBufferView | ArrayBuffer, options?: DeserializeOptions) => Document
      • (buffer: Buffer | ArrayBufferView | ArrayBuffer, options?: DeserializeOptions): Document
      • Deserialize data as BSON.

        Parameters

        • buffer: Buffer | ArrayBufferView | ArrayBuffer

          the buffer containing the serialized set of BSON documents.

        • Optional options: DeserializeOptions

        Returns Document

        returns the deserialized Javascript Object.

  • serialize: (object: Document, options?: SerializeOptions) => Buffer
      • (object: Document, options?: SerializeOptions): Buffer
      • Serialize a Javascript object.

        Parameters

        • object: Document

          the Javascript object to serialize.

        • Optional options: SerializeOptions

        Returns Buffer

        Buffer object containing the serialized object.

Optional ismaster

ismaster: Document
internal

s

internal

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

capabilities

clientMetadata

clusterTime

description

logicalSessionTimeoutMinutes

  • get logicalSessionTimeoutMinutes(): undefined | number

Methods

addListener

auth

close

connect

Private detectShardedTopology

Private detectSrvRecords

emit

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

    • EventKey: keyof ConnectionEvents | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged" | "serverOpening" | "serverClosed" | "serverDescriptionChanged" | "topologyOpening" | "topologyClosed" | "topologyDescriptionChanged" | "error" | "timeout" | "open"

    Parameters

    • event: symbol | EventKey
    • Rest ...args: Parameters<TopologyEvents[EventKey]>

    Returns boolean

endSessions

eventNames

  • eventNames(): string[]

getMaxListeners

  • getMaxListeners(): number

hasSessionSupport

  • hasSessionSupport(): boolean

isConnected

  • isConnected(): boolean

isDestroyed

  • isDestroyed(): boolean

lastIsMaster

listenerCount

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

    • EventKey: keyof ConnectionEvents | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged" | "serverOpening" | "serverClosed" | "serverDescriptionChanged" | "topologyOpening" | "topologyClosed" | "topologyDescriptionChanged" | "error" | "timeout" | "open"

    Parameters

    • type: string | symbol | EventKey

    Returns number

listeners

  • listeners<EventKey>(event: string | symbol | EventKey): TopologyEvents[EventKey][]
  • Type parameters

    • EventKey: keyof ConnectionEvents | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged" | "serverOpening" | "serverClosed" | "serverDescriptionChanged" | "topologyOpening" | "topologyClosed" | "topologyDescriptionChanged" | "error" | "timeout" | "open"

    Parameters

    • event: string | symbol | EventKey

    Returns TopologyEvents[EventKey][]

off

on

  • Type parameters

    • EventKey: keyof ConnectionEvents | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged" | "serverOpening" | "serverClosed" | "serverDescriptionChanged" | "topologyOpening" | "topologyClosed" | "topologyDescriptionChanged" | "error" | "timeout" | "open"

    Parameters

    Returns Topology

  • Parameters

    Returns Topology

  • Parameters

    Returns Topology

once

prependListener

prependOnceListener

rawListeners

  • rawListeners<EventKey>(event: string | symbol | EventKey): TopologyEvents[EventKey][]
  • Type parameters

    • EventKey: keyof ConnectionEvents | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged" | "serverOpening" | "serverClosed" | "serverDescriptionChanged" | "topologyOpening" | "topologyClosed" | "topologyDescriptionChanged" | "error" | "timeout" | "open"

    Parameters

    • event: string | symbol | EventKey

    Returns TopologyEvents[EventKey][]

removeAllListeners

  • removeAllListeners<EventKey>(event?: string | symbol | EventKey): Topology
  • Type parameters

    • EventKey: keyof ConnectionEvents | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged" | "serverOpening" | "serverClosed" | "serverDescriptionChanged" | "topologyOpening" | "topologyClosed" | "topologyDescriptionChanged" | "error" | "timeout" | "open"

    Parameters

    • Optional event: string | symbol | EventKey

    Returns Topology

removeListener

selectServer

serverUpdateHandler

  • Update the internal TopologyDescription with a ServerDescription

    Parameters

    • serverDescription: ServerDescription

      The server to update in the internal list of server descriptions

    Returns void

setMaxListeners

shouldCheckForSessionSupport

  • shouldCheckForSessionSupport(): boolean
  • Returns boolean

    Whether the topology should initiate selection to determine session support

startSession

unref

  • unref(): void

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