Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Db

Index

Constructors

constructor

Properties

bufferMaxEntries

bufferMaxEntries: number

Current bufferMaxEntries value for the database.

databaseName

databaseName: string

The name of the database this instance represents.

native_parser

native_parser: boolean

The current value of the parameter native_parser.

options

options: any

The options associated with the db instance.

serverConfig

serverConfig: Server | ReplSet | Mongos

Get the current db topology.

slaveOk

slaveOk: boolean

The current slaveOk value for the db instance.

writeConcern

writeConcern: any

The current write concern values.

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

addUser

admin

authenticate

  • authenticate(userName: string, password: string, callback: MongoCallback<any>): void
  • authenticate(userName: string, password: string, options?: undefined | object): Promise<any>
  • authenticate(userName: string, password: string, options: object, callback: MongoCallback<any>): void

close

  • close(callback: MongoCallback<void>): void
  • close(forceClose?: undefined | true | false): Promise<void>
  • close(forceClose: boolean, callback: MongoCallback<void>): void

collection

collections

command

  • command(command: Object, callback: MongoCallback<any>): void
  • command(command: Object, options?: undefined | object): Promise<any>
  • command(command: Object, options: object, callback: MongoCallback<any>): void

createCollection

createIndex

db

  • db(dbName: string): Db
  • db(dbName: string, options: DbOptions): Db
  • Create a new Db instance sharing the current socket connections. Be aware that the new db instances are related in a parent-child relationship to the original instance so that events are correctly emitted on child db instances. Child db instances are cached so performing db('db1') twice will return the same instance. You can control these behaviors with the options noListener and returnNonCachedInstance.

    see

    http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#db

    Parameters

    • dbName: string

      The name of the database we want to use.

    Returns Db

  • Create a new Db instance sharing the current socket connections. Be aware that the new db instances are related in a parent-child relationship to the original instance so that events are correctly emitted on child db instances. Child db instances are cached so performing db('db1') twice will return the same instance. You can control these behaviors with the options noListener and returnNonCachedInstance.

    see

    http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#db

    Parameters

    • dbName: string

      The name of the database we want to use.

    • options: DbOptions

      Optional.

    Returns Db

dropCollection

  • dropCollection(name: string): Promise<boolean>
  • dropCollection(name: string, callback: MongoCallback<boolean>): void

dropDatabase

  • dropDatabase(): Promise<any>
  • dropDatabase(callback: MongoCallback<any>): void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

executeDbAdminCommand

getMaxListeners

  • getMaxListeners(): number
  • Returns number

indexInformation

listCollections

listenerCount

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

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

logout

  • logout(callback: MongoCallback<any>): void
  • logout(options?: undefined | object): Promise<any>
  • logout(options: object, callback: MongoCallback<any>): void

on

  • on(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

open

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

removeUser

  • removeUser(username: string, callback: MongoCallback<any>): void
  • removeUser(username: string, options?: undefined | object): Promise<any>
  • removeUser(username: string, options: object, callback: MongoCallback<any>): void

renameCollection

  • renameCollection(fromCollection: string, toCollection: string, callback: MongoCallback<Collection>): void
  • renameCollection(fromCollection: string, toCollection: string, options?: undefined | object): Promise<Collection>
  • renameCollection(fromCollection: string, toCollection: string, options: object, callback: MongoCallback<Collection>): void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

stats

  • stats(callback: MongoCallback<any>): void
  • stats(options?: undefined | object): Promise<any>
  • stats(options: object, callback: MongoCallback<any>): void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc