Class Db

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(databaseName: string, serverConfig: Server, dbOptions?: DbCreateOptions): Db

Parameters

Returns

Db

Properties

public DEFAULT_URL: string

Methods

public __executeQueryCommand(self: any, db_command: any, options: any, callback: any)

Parameters

  • self: any
  • db_command: any
  • options: any
  • callback: any

public _callHandler(id: any, document: any, err: any): any

Parameters

  • id: any
  • document: any
  • err: any

Returns

any

public _findHandler(id: any): { id: string; callback: Function; }

Parameters

  • id: any

Returns

{ id: string; callback: Function; }

public _hasHandler(id: any): any

Parameters

  • id: any

Returns

any

public _reRegisterHandler(newId: any, object: any, callback: Function)

Parameters

  • newId: any
  • object: any
  • callback: Function

public _registerHandler(db_command: any, raw: any, connection: any, exhaust: any, callback: Function)

Parameters

  • db_command: any
  • raw: any
  • connection: any
  • exhaust: any
  • callback: Function

public _removeHandler(id: any): any

Parameters

  • id: any

Returns

any

public addListener(event: string, handler: (param: any) => any): any

Parameters

  • event: string
  • handler: (param: any) => any

Returns

any

public addUser(username: string, password: string, callback?: (err: Error, result: any) => void)

Parameters

  • username: string
  • password: string
  • callback?: (err: Error, result: any) => void optional

public addUser(username: string, password: string, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • username: string
  • password: string
  • options: any
  • callback?: (err: Error, result: any) => void optional

public admin(callback: (err: Error, result: any) => void): any

Parameters

  • callback: (err: Error, result: any) => void

Returns

any

public authenticate(userName: string, password: string, callback?: (err: Error, result: any) => void)

Parameters

  • userName: string
  • password: string
  • callback?: (err: Error, result: any) => void optional

public authenticate(userName: string, password: string, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • userName: string
  • password: string
  • options: any
  • callback?: (err: Error, result: any) => void optional

public close(forceClose?: boolean, callback?: (err: Error, result: any) => void)

Parameters

  • forceClose?: boolean optional
  • callback?: (err: Error, result: any) => void optional

public collection(collectionName: string): Collection

Parameters

  • collectionName: string

Returns

Collection

public collection(collectionName: string, callback: (err: Error, collection: "mongodb".Collection) => void): Collection

Parameters

  • collectionName: string
  • callback: (err: Error, collection: "mongodb".Collection) => void

Returns

Collection

public collection(collectionName: string, options: MongoCollectionOptions, callback: (err: Error, collection: "mongodb".Collection) => void): Collection

Parameters

  • collectionName: string
  • options: MongoCollectionOptions
  • callback: (err: Error, collection: "mongodb".Collection) => void

Returns

Collection

public collectionNames(collectionName: string, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • collectionName: string
  • options: any
  • callback?: (err: Error, result: any) => void optional

public collections(callback: (err: Error, collections: "mongodb".Collection[]) => void)

Parameters

  • callback: (err: Error, collections: "mongodb".Collection[]) => void

public collectionsInfo(collectionName: string, callback?: (err: Error, result: any) => void)

Parameters

  • collectionName: string
  • callback?: (err: Error, result: any) => void optional

public command(selector: Object, callback?: (err: Error, result: any) => void)

Parameters

  • selector: Object
  • callback?: (err: Error, result: any) => void optional

public command(selector: Object, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • selector: Object
  • options: any
  • callback?: (err: Error, result: any) => void optional

public connect(url: string, options: { uri_decode_auth?: boolean; }, callback: (err: Error, result: any) => void)

Parameters

  • url: string
  • options: { uri_decode_auth?: boolean; }
  • callback: (err: Error, result: any) => void

public createCollection(collectionName: string, callback?: (err: Error, result: "mongodb".Collection) => void)

Parameters

  • collectionName: string
  • callback?: (err: Error, result: "mongodb".Collection) => void optional

public createCollection(collectionName: string, options: CollectionCreateOptions, callback?: (err: Error, result: any) => void)

Parameters

public createIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback: Function)

Parameters

  • collectionName: any
  • fieldOrSpec: any
  • options: IndexOptions
  • callback: Function

public cursorInfo(options: any, callback: Function)

Parameters

  • options: any
  • callback: Function

public db(dbName: string): Db

Parameters

  • dbName: string

Returns

Db

public dropCollection(collectionName: string, callback?: (err: Error, result: any) => void)

Parameters

  • collectionName: string
  • callback?: (err: Error, result: any) => void optional

public dropDatabase(callback: (err: Error, result: any) => void)

Parameters

  • callback: (err: Error, result: any) => void

public dropIndex(collectionName: string, indexName: string, callback: Function)

Parameters

  • collectionName: string
  • indexName: string
  • callback: Function

public ensureIndex(collectionName: any, fieldOrSpec: any, options: IndexOptions, callback: Function)

Parameters

  • collectionName: any
  • fieldOrSpec: any
  • options: IndexOptions
  • callback: Function

public eval(code: any, parameters: Array<any>, options?: any, callback?: (err: Error, result: any) => void)

Parameters

  • code: any
  • parameters: Array<any>
  • options?: any optional
  • callback?: (err: Error, result: any) => void optional

public executeDbAdminCommand(command_hash: any, callback?: (err: Error, result: any) => void)

Parameters

  • command_hash: any
  • callback?: (err: Error, result: any) => void optional

public executeDbAdminCommand(command_hash: any, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • command_hash: any
  • options: any
  • callback?: (err: Error, result: any) => void optional

public executeDbCommand(command_hash: any, callback?: (err: Error, result: any) => void)

Parameters

  • command_hash: any
  • callback?: (err: Error, result: any) => void optional

public executeDbCommand(command_hash: any, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • command_hash: any
  • options: any
  • callback?: (err: Error, result: any) => void optional

public indexInformation(collectionName: string, options: any, callback: Function)

Parameters

  • collectionName: string
  • options: any
  • callback: Function

public lastError(options: Object, connectionOptions: any, callback: (err: Error, result: any) => void)

Parameters

  • options: Object
  • connectionOptions: any
  • callback: (err: Error, result: any) => void

public logout(options: any, callback?: (err: Error, result: any) => void)

Parameters

  • options: any
  • callback?: (err: Error, result: any) => void optional

public logout(callback: (err: Error, result: any) => void)

Parameters

  • callback: (err: Error, result: any) => void

public open(callback: (err: Error, db: "mongodb".Db) => void)

Parameters

  • callback: (err: Error, db: "mongodb".Db) => void

public previousError(options: Object, callback: (err: Error, result: any) => void)

Parameters

  • options: Object
  • callback: (err: Error, result: any) => void

public reIndex(collectionName: string, callback: Function)

Parameters

  • collectionName: string
  • callback: Function

public removeUser(username: string, callback?: (err: Error, result: any) => void)

Parameters

  • username: string
  • callback?: (err: Error, result: any) => void optional

public removeUser(username: string, options: any, callback?: (err: Error, result: any) => void)

Parameters

  • username: string
  • options: any
  • callback?: (err: Error, result: any) => void optional

public renameCollection(fromCollection: string, toCollection: string, callback?: (err: Error, result: any) => void)

Parameters

  • fromCollection: string
  • toCollection: string
  • callback?: (err: Error, result: any) => void optional

public resetErrorHistory(callback?: (err: Error, result: any) => void)

Parameters

  • callback?: (err: Error, result: any) => void optional

public resetErrorHistory(options: any, callback?: (err: Error, result: any) => void)

Parameters

  • options: any
  • callback?: (err: Error, result: any) => void optional

public stats(options: any, callback: Function)

Parameters

  • options: any
  • callback: Function