Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Server

internal

Hierarchy

Index

Constructors

constructor

Events

Static Readonly CLOSED

CLOSED: "closed" = ...

Static Readonly CONNECT

CONNECT: "connect" = ...

Static Readonly DESCRIPTION_RECEIVED

DESCRIPTION_RECEIVED: "descriptionReceived" = ...

Static Readonly ENDED

ENDED: "ended" = ...

Static Readonly SERVER_HEARTBEAT_FAILED

SERVER_HEARTBEAT_FAILED: "serverHeartbeatFailed" = ...

Static Readonly SERVER_HEARTBEAT_STARTED

SERVER_HEARTBEAT_STARTED: "serverHeartbeatStarted" = ...

Static Readonly SERVER_HEARTBEAT_SUCCEEDED

SERVER_HEARTBEAT_SUCCEEDED: "serverHeartbeatSucceeded" = ...

Properties

[kMonitor]

[kMonitor]: Monitor

Optional clusterTime

clusterTime: ClusterTime

Optional ismaster

ismaster: Document

s

internal

Optional serverApi

serverApi: ServerApi

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

autoEncrypter

description

loadBalanced

  • get loadBalanced(): boolean

name

  • get name(): string

Methods

addListener

command

connect

  • connect(): void

destroy

emit

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

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

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

    Returns boolean

eventNames

  • eventNames(): string[]

getMaxListeners

  • getMaxListeners(): number

getMore

killCursors

listenerCount

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

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    • type: string | symbol | EventKey

    Returns number

listeners

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

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    • event: string | symbol | EventKey

    Returns ServerEvents[EventKey][]

off

  • Type parameters

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    Returns Server

  • Parameters

    Returns Server

  • Parameters

    Returns Server

on

  • Type parameters

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    Returns Server

  • Parameters

    Returns Server

  • Parameters

    Returns Server

once

  • Type parameters

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    Returns Server

  • Parameters

    Returns Server

  • Parameters

    Returns Server

prependListener

prependOnceListener

query

rawListeners

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

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    • event: string | symbol | EventKey

    Returns ServerEvents[EventKey][]

removeAllListeners

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

    • EventKey: "commandStarted" | "commandSucceeded" | "commandFailed" | "clusterTimeReceived" | "pinned" | "unpinned" | "connect" | "serverHeartbeatStarted" | "serverHeartbeatSucceeded" | "serverHeartbeatFailed" | "descriptionReceived" | "closed" | "ended" | "connectionPoolCreated" | "connectionPoolClosed" | "connectionPoolCleared" | "connectionCreated" | "connectionReady" | "connectionClosed" | "connectionCheckOutStarted" | "connectionCheckOutFailed" | "connectionCheckedOut" | "connectionCheckedIn" | "stateChanged"

    Parameters

    • Optional event: string | symbol | EventKey

    Returns Server

removeListener

requestCheck

  • requestCheck(): void
  • Immediately schedule monitoring of this server. If there already an attempt being made this will be a no-op.

    Returns void

setMaxListeners

  • setMaxListeners(n: number): Server

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