MongoDB Instance Handler Class This Class starts & stops the "mongod" process directly and handles stdout, sterr and close events

Hierarchy

  • EventEmitter
    • MongoInstance

Implements

Constructors

Properties

binaryOpts: Readonly<MongoBinaryOpts>
extraConnectionOptions?: MongoClientOptions

Extra options to append to "mongoclient.connect" Mainly used for authentication

isInstancePrimary: boolean = false

This boolean is "true" if the instance is elected to be PRIMARY

isInstanceReady: boolean = false

This boolean is "true" if the instance is successfully started

isReplSet: boolean = false

This boolean is "true" if the instance is part of an replset

killerProcess?: ChildProcess

The "mongo_killer" Process reference

mongodProcess?: ChildProcess

The "mongod" Process reference

spawnOpts: Readonly<SpawnOptions>
stopPromise?: Promise<boolean>

Extra promise to avoid multiple calls of .stop at the same time

captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

defaultMaxListeners: number
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.

Methods

  • Spawn an seperate process to kill the parent and the mongod instance to ensure "mongod" gets stopped in any case

    Parameters

    • parentPid: number

      Parent nodejs process

    • childPid: number

      Mongod process to kill

    Returns ChildProcess

    Fires

    MongoInstance#killerLaunched

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns MongoInstance

  • Returns (string | symbol)[]

  • Returns number

  • Parameters

    • event: string | symbol

    Returns number

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns MongoInstance

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns MongoInstance

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns MongoInstance

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

    • Optional event: string | symbol

    Returns MongoInstance

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns MongoInstance

  • Parameters

    • n: number

    Returns MongoInstance

  • Write STDOUT to debug function and process some special messages

    Parameters

    • message: string | Buffer

      The STDOUT line to write/parse

    Returns void

    Fires

    MongoInstance#instanceSTDOUT

    Fires

    MongoInstance#instanceReady

    Fires

    MongoInstance#instanceError

    Fires

    MongoInstance#instancePrimary

    Fires

    MongoInstance#instanceReplState

  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

    Deprecated

    since v4.0.0

  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc