Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Db

Hierarchy

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: WriteConcern

The current write concern values.

Methods

addUser

admin

authenticate

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

close

  • close(callback: MongoCallback<void>): void
  • close(forceClose?: boolean): Promise<void>
  • close(forceClose: boolean, callback: MongoCallback<void>): void

collection

collections

command

  • command(command: Object, callback: MongoCallback<any>): void
  • command(command: Object, options?: 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

executeDbAdminCommand

indexInformation

listCollections

logout

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

open

removeUser

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

renameCollection

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

stats

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

watch

Generated using TypeDoc