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

  • 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

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

  • 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

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

  • 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

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