Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ClientSession

A class representing a client session on the server

NOTE: not meant to be instantiated directly.

Hierarchy层级

Index索引

Constructors构造函数

constructor

Properties属性

Optional [kPinnedConnection]

[kPinnedConnection]: Connection
internal

Optional [kServerSession]

[kServerSession]: ServerSession
internal

[kSnapshotEnabled]

[kSnapshotEnabled]: boolean = false
internal

Optional [kSnapshotTime]

[kSnapshotTime]: Timestamp
internal

Optional clientOptions

clientOptions: MongoOptions

Optional clusterTime

clusterTime: ClusterTime

defaultTransactionOptions

defaultTransactionOptions: TransactionOptions

explicit

explicit: boolean

hasEnded

hasEnded: boolean

Optional operationTime

operationTime: Timestamp

Optional owner

owner: symbol | AbstractCursor<any, AbstractCursorEvents>
internal

sessionPool

sessionPool: ServerSessionPool
internal

supports

supports: { causalConsistency: boolean }

Type declaration类型声明

  • causalConsistency: boolean

topology

topology: Topology
internal

transaction

transaction: Transaction

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访问器

id

isPinned

  • get isPinned(): boolean

loadBalanced

  • get loadBalanced(): boolean

pinnedConnection

serverSession

snapshotEnabled

  • get snapshotEnabled(): boolean
  • Whether or not this session is configured for snapshot reads

    Returns返回boolean

Methods方法

abortTransaction

addListener

advanceClusterTime

  • Advances the clusterTime for a ClientSession to the provided clusterTime of another ClientSession

    Parameters参数

    • clusterTime: ClusterTime

      the $clusterTime returned by the server from another session in the form of a document containing the BSON.Timestamp clusterTime and signature

    Returns返回void

advanceOperationTime

  • advanceOperationTime(operationTime: Timestamp): void
  • Advances the operationTime for a ClientSession.

    Parameters参数

    • operationTime: Timestamp

      the BSON.Timestamp of the operation type it is desired to advance to

    Returns返回void

commitTransaction

emit

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

endSession

equals

  • Used to determine if this session equals another

    Parameters参数

    Returns返回boolean

eventNames

  • eventNames(): string[]

getMaxListeners

  • getMaxListeners(): number

inTransaction

  • inTransaction(): boolean
  • Returns返回boolean

    whether this session is currently in a transaction or not

incrementTransactionNumber

  • incrementTransactionNumber(): void
  • Increment the transaction number on the internal ServerSession

    Returns返回void

listenerCount

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

listeners

off

on

once

pin

prependListener

prependOnceListener

rawListeners

removeAllListeners

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

removeListener

setMaxListeners

startTransaction

  • Starts a new transaction with the given options.

    Parameters参数

    Returns返回void

toBSON

  • toBSON(): never
  • This is here to ensure that ClientSession is never serialized to BSON.

    Returns返回never

unpin

  • unpin(options?: { error?: AnyError; force?: boolean; forceClear?: boolean }): void
  • internal

    Parameters参数

    • Optional options: { error?: AnyError; force?: boolean; forceClear?: boolean }
      • Optional error?: AnyError
      • Optional force?: boolean
      • Optional forceClear?: boolean

    Returns返回void

withTransaction

  • Runs a provided lambda within a transaction, retrying either the commit operation or entire transaction as needed (and when the error permits) to better ensure that the transaction can complete successfully.

    IMPORTANT: This method requires the user to return a Promise, all lambdas that do not return a Promise will result in undefined behavior.

    Type parameters类型参数

    • T = void

    Parameters参数

    Returns返回Promise<T>

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