Interface Collection

Index

Construct signatures

Properties

Methods

Construct signatures

constructor(db: Db, collectionName: string, pkFactory?: Object, options?: CollectionCreateOptions): any

Parameters

Returns

any

Properties

public hint: any

Methods

public aggregate(pipeline: Array<any>, callback: (err: Error, results: any) => void)

Parameters

  • pipeline: Array<any>
  • callback: (err: Error, results: any) => void

public aggregate(pipeline: Array<any>, options: { readPreference: string; }, callback: (err: Error, results: any) => void)

Parameters

  • pipeline: Array<any>
  • options: { readPreference: string; }
  • callback: (err: Error, results: any) => void

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

Parameters

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

public count(query: Object, callback: (err: Error, result: any) => void)

Parameters

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

public count(query: Object, options: { readPreferences: string; }, callback: (err: Error, result: any) => void)

Parameters

  • query: Object
  • options: { readPreferences: string; }
  • callback: (err: Error, result: any) => void

public createIndex(fieldOrSpec: any, options: IndexOptions, callback: (err: Error, indexName: string) => void)

Parameters

  • fieldOrSpec: any
  • options: IndexOptions
  • callback: (err: Error, indexName: string) => void

public distinct(key: string, query: Object, callback: (err: Error, result: any) => void)

Parameters

  • key: string
  • query: Object
  • callback: (err: Error, result: any) => void

public distinct(key: string, query: Object, options: { readPreferences: string; }, callback: (err: Error, result: any) => void)

Parameters

  • key: string
  • query: Object
  • options: { readPreferences: string; }
  • callback: (err: Error, result: any) => void

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

Parameters

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

public dropAllIndexes(callback: Function)

Parameters

  • callback: Function

public dropIndex(name: string, callback: Function)

Parameters

  • name: string
  • callback: Function

public ensureIndex(fieldOrSpec: any, options: IndexOptions, callback: (err: Error, indexName: string) => void)

Parameters

  • fieldOrSpec: any
  • options: IndexOptions
  • callback: (err: Error, indexName: string) => void

public find(callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

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

Returns

Cursor

public find(selector: Object, callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

  • selector: Object
  • callback?: (err: Error, result: "mongodb".Cursor) => void optional

Returns

Cursor

public find(selector: Object, fields: any, callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

  • selector: Object
  • fields: any
  • callback?: (err: Error, result: "mongodb".Cursor) => void optional

Returns

Cursor

public find(selector: Object, options: CollectionFindOptions, callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

  • selector: Object
  • options: CollectionFindOptions
  • callback?: (err: Error, result: "mongodb".Cursor) => void optional

Returns

Cursor

public find(selector: Object, fields: any, options: CollectionFindOptions, callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

  • selector: Object
  • fields: any
  • options: CollectionFindOptions
  • callback?: (err: Error, result: "mongodb".Cursor) => void optional

Returns

Cursor

public find(selector: Object, fields: any, skip: number, limit: number, callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

  • selector: Object
  • fields: any
  • skip: number
  • limit: number
  • callback?: (err: Error, result: "mongodb".Cursor) => void optional

Returns

Cursor

public find(selector: Object, fields: any, skip: number, limit: number, timeout: number, callback?: (err: Error, result: "mongodb".Cursor) => void): Cursor

Parameters

  • selector: Object
  • fields: any
  • skip: number
  • limit: number
  • timeout: number
  • callback?: (err: Error, result: "mongodb".Cursor) => void optional

Returns

Cursor

public findAndModify(query: Object, sort: Array<any>, doc: Object, callback: (err: Error, result: any) => void)

Parameters

  • query: Object
  • sort: Array<any>
  • doc: Object
  • callback: (err: Error, result: any) => void

public findAndModify(query: Object, sort: Array<any>, doc: Object, options: { safe?: any; remove?: boolean; upsert?: boolean; new?: boolean; }, callback: (err: Error, result: any) => void)

Parameters

  • query: Object
  • sort: Array<any>
  • doc: Object
  • options: { safe?: any; remove?: boolean; upsert?: boolean; new?: boolean; }
  • callback: (err: Error, result: any) => void

public findAndRemove(query: Object, sort?: Array<any>, callback?: (err: Error, result: any) => void)

Parameters

  • query: Object
  • sort?: Array<any> optional
  • callback?: (err: Error, result: any) => void optional

public findAndRemove(query: Object, sort?: Array<any>, options?: { safe: any; }, callback?: (err: Error, result: any) => void)

Parameters

  • query: Object
  • sort?: Array<any> optional
  • options?: { safe: any; } optional
  • callback?: (err: Error, result: any) => void optional

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

Parameters

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

Returns

Cursor

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

Parameters

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

Returns

Cursor

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

Parameters

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

Returns

Cursor

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

Parameters

Returns

Cursor

public findOne(selector: Object, fields: any, options: CollectionFindOptions, callback?: (err: Error, result: any) => void): Cursor

Parameters

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

Returns

Cursor

public findOne(selector: Object, fields: any, skip: number, limit: number, callback?: (err: Error, result: any) => void): Cursor

Parameters

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

Returns

Cursor

public findOne(selector: Object, fields: any, skip: number, limit: number, timeout: number, callback?: (err: Error, result: any) => void): Cursor

Parameters

  • selector: Object
  • fields: any
  • skip: number
  • limit: number
  • timeout: number
  • callback?: (err: Error, result: any) => void optional

Returns

Cursor

public geoHaystackSearch(x: number, y: number, callback: Function)

Parameters

  • x: number
  • y: number
  • callback: Function

public geoHaystackSearch(x: number, y: number, options: Object, callback: Function)

Parameters

  • x: number
  • y: number
  • options: Object
  • callback: Function

public geoNear(x: number, y: number, callback: Function)

Parameters

  • x: number
  • y: number
  • callback: Function

public geoNear(x: number, y: number, options: Object, callback: Function)

Parameters

  • x: number
  • y: number
  • options: Object
  • callback: Function

public group(keys: Object, condition: Object, initial: Object, reduce: Function, finalize: Function, command: boolean, options: { readPreference: string; }, callback: Function)

Parameters

  • keys: Object
  • condition: Object
  • initial: Object
  • reduce: Function
  • finalize: Function
  • command: boolean
  • options: { readPreference: string; }
  • callback: Function

public indexExists(indexes: string, callback: Function)

Parameters

  • indexes: string
  • callback: Function

public indexInformation(options: any, callback: Function)

Parameters

  • options: any
  • callback: Function

public indexes(callback: Function)

Parameters

  • callback: Function

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

Parameters

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

public insert(query: any, options: { safe?: any; continueOnError?: boolean; keepGoing?: boolean; serializeFunctions?: boolean; }, callback: (err: Error, result: any) => void)

Parameters

  • query: any
  • options: { safe?: any; continueOnError?: boolean; keepGoing?: boolean; serializeFunctions?: boolean; }
  • callback: (err: Error, result: any) => void

public isCapped(callback: Function)

Parameters

  • callback: Function

public mapReduce(map: Function, reduce: Function, options: MapReduceOptions, callback: Function)

Parameters

public options(callback: Function)

Parameters

  • callback: Function

public reIndex(callback: Function)

Parameters

  • callback: Function

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

Parameters

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

public remove(selector: Object, options: { safe?: any; single?: boolean; }, callback?: (err: Error, result: any) => void)

Parameters

  • selector: Object
  • options: { safe?: any; single?: boolean; }
  • callback?: (err: Error, result: any) => void optional

public rename(newName: String, callback?: (err: Error, result: any) => void)

Parameters

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

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

Parameters

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

public save(doc: any, options: { safe: any; }, callback: (err: Error, result: any) => void)

Parameters

  • doc: any
  • options: { safe: any; }
  • callback: (err: Error, result: any) => void

public stats(options: { readPreference: string; scale: number; }, callback: Function)

Parameters

  • options: { readPreference: string; scale: number; }
  • callback: Function

public stats(callback: (err: Error, results: any) => void)

Parameters

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

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

Parameters

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

public update(selector: Object, document: any, options: { safe?: boolean; upsert?: any; multi?: boolean; serializeFunctions?: boolean; }, callback: (err: Error, result: any) => void)

Parameters

  • selector: Object
  • document: any
  • options: { safe?: boolean; upsert?: any; multi?: boolean; serializeFunctions?: boolean; }
  • callback: (err: Error, result: any) => void