Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • MongoMemoryServer

Implements

  • ManagerAdvanced

Index

Constructors

constructor

Properties

Protected Optional _instanceInfo

_instanceInfo: MongoInstanceData

Information about the started instance

Protected _state

_state: MongoMemoryServerStates = ...

The Current State of this instance

Optional Readonly auth

auth: Required<AutomaticAuth>

Original Auth Configuration (this.opts can be changed if stopped, but auth cannot be changed here)

opts

opts: MongoMemoryServerOpts

General Options for this Instance

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

instanceInfo

  • get instanceInfo(): undefined | MongoInstanceData

state

  • get state(): MongoMemoryServerStates

Methods

Private _startUpInstance

  • _startUpInstance(forceSamePort?: boolean): Promise<void>

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): MongoMemoryServer
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MongoMemoryServer

Protected authObjectEnable

  • authObjectEnable(): boolean

cleanup

  • cleanup(force: boolean): Promise<void>
  • cleanup(options?: Cleanup): Promise<void>
  • Remove the defined dbPath

    throws

    If "state" is not "stopped"

    throws

    If "instanceInfo" is not defined

    throws

    If an fs error occured

    deprecated

    replace argument with Cleanup interface object

    Parameters

    • force: boolean

      Remove the dbPath even if it is no "tmpDir" (and re-check if tmpDir actually removed it)

    Returns Promise<void>

  • Remove the defined dbPath

    throws

    If "state" is not "stopped"

    throws

    If "instanceInfo" is not defined

    throws

    If an fs error occured

    Parameters

    • Optional options: Cleanup

      Set how to run a cleanup, by default { doCleanup: true } is used

    Returns Promise<void>

createAuth

  • createAuth(data: StartupInstanceData): Promise<void>

Protected debug

  • debug(msg: string, ...extra: unknown[]): void

emit

  • emit(event: stateChange, ...args: any[]): boolean

ensureInstance

  • ensureInstance(): Promise<MongoInstanceData>

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Protected getNewPort

  • getNewPort(port?: number): Promise<number>

Protected getStartOptions

  • getStartOptions(forceSamePort?: boolean): Promise<MongoMemoryServerGetStartOptions>

getUri

  • getUri(otherDb?: string, otherIp?: string): string

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MongoMemoryServer

on

once

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): MongoMemoryServer
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MongoMemoryServer

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): MongoMemoryServer
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MongoMemoryServer

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • Parameters

    • Optional event: string | symbol

    Returns MongoMemoryServer

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): MongoMemoryServer
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MongoMemoryServer

setMaxListeners

  • Parameters

    • n: number

    Returns MongoMemoryServer

start

  • start(forceSamePort?: boolean): Promise<void>

Protected stateChange

  • stateChange(newState: MongoMemoryServerStates): void

stop

  • stop(runCleanup: boolean): Promise<boolean>
  • stop(cleanupOptions?: Cleanup): Promise<boolean>

Static create

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): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

Static once

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

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc