### Hierarchy

- Collection

## Index

### Constructors

- constructor

### Properties

- databaseName
- doc_indexes
- docs
- emit
- fullName
- logger
- name
- snapshots

### Methods

- aggregate
- backup
- backups
- bulkInsert
- clearBackups
- delete
- destroy
- drop
- ensureIndex
- find
- findOne
- insert
- remove
- removeBackup
- rename
- restore
- save
- update
- checkCollectionName

### Object literals

- _noCreateModifiers

## Constructors

### constructor

- new Collection(db: any, collectionName: any): Collection

- - Defined in collection/Collection.ts:59

  #### Parameters

  - ##### db: any

    Additional options

  - ##### collectionName: any

    The name of the collection

  #### Returns Collection

## Properties

### databaseName

databaseName: any

- Defined in collection/Collection.ts:53

### doc_indexes

doc_indexes: any

- Defined in collection/Collection.ts:56

### docs

docs: any

- Defined in collection/Collection.ts:55

### emit

emit: Function

- Defined in collection/Collection.ts:59

### fullName

fullName: any

- Defined in collection/Collection.ts:54

### Protected logger

logger: JSWLogger

- Defined in collection/Collection.ts:50

### name

name: any

- Defined in collection/Collection.ts:52

### snapshots

snapshots: any

- Defined in collection/Collection.ts:57

## Methods

### aggregate

- aggregate(pipeline: any, options?: object): any

- - Defined in collection/Collection.ts:1045

  Calculates aggregate values for the data in a collection

  #### Parameters

  - ##### pipeline: any

    A sequence of data aggregation operations or stages

  - ##### Default value options: object = { forceFetch: false }

    - ##### forceFetch: boolean

  #### Returns any

  If "options.forceFetch" set to true returns the array of documents, otherwise returns a cursor

### backup

- backup(backupID: any, callback?: any): Promise<any>

- - Defined in collection/Collection.ts:888

  #### Parameters

  - ##### backupID: any

  - ##### Optional callback: any

  #### Returns Promise<any>

### backups

- backups(): Array<any>

- - Defined in collection/Collection.ts:926

  #### Returns Array<any>

### bulkInsert

- bulkInsert(docs: any, options: any, callback?: any): ThenPromise<Object>

- - Defined in collection/Collection.ts:232

  Inserts several documents into the collection

  #### Parameters

  - ##### docs: any

    Documents to be inserted

  - ##### options: any

  - ##### Optional callback: any

  #### Returns ThenPromise<Object>

  Returns a promise with the inserted documents

### clearBackups

- clearBackups(): void

- - Defined in collection/Collection.ts:972

  #### Returns void

### delete

- delete(selection: any, options: any, callback?: any): Promise<Object[]>

- - Defined in collection/Collection.ts:767

  Alias for {@link Collection#remove}

  #### Parameters

  - ##### selection: any

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<Object[]>

### destroy

- destroy(selection: any, options: any, callback?: any): Promise<Object[]>

- - Defined in collection/Collection.ts:776

  Alias for {@link Collection#remove}

  #### Parameters

  - ##### selection: any

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<Object[]>

### drop

- drop(options: any, callback?: any): Promise<Object[]>

- - Defined in collection/Collection.ts:794

  Drops a collection

  #### Parameters

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<Object[]>

  Promise with the deleted documents

### ensureIndex

- ensureIndex(): void

- - Defined in collection/Collection.ts:877

  #### Returns void

### find

- find(selection: any, fields: any, options: any, callback?: any): ThenPromise<Object>

- - Defined in collection/Collection.ts:288

  Finds all matching documents

  #### Parameters

  - ##### selection: any

  - ##### fields: any

  - ##### options: any

  - ##### Optional callback: any

  #### Returns ThenPromise<Object>

  Returns a promise with the documents (or cursor if "options.forceFetch" set to true)

### findOne

- findOne(selection: any, fields: any, options: any, callback?: any): Promise<any>

- - Defined in collection/Collection.ts:357

  Finds the first matching document

  #### Parameters

  - ##### selection: any

  - ##### fields: any

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<any>

  Returns a promise with the first matching document of the collection

### insert

- insert(doc: any, options: any, callback?: any): Promise<any>

- - Defined in collection/Collection.ts:159

  Inserts a document into the collection

  #### Parameters

  - ##### doc: any

    Document to be inserted

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<any>

  Returns a promise with the inserted document

### remove

- remove(selection: any, options: any, callback?: any): Promise<Object[]>

- - Defined in collection/Collection.ts:686

  Removes one or many documents

  #### Parameters

  - ##### selection: any

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<Object[]>

  Promise with the deleted documents

### removeBackup

- removeBackup(backupID: any): String

- - Defined in collection/Collection.ts:944

  #### Parameters

  - ##### backupID: any

  #### Returns String

### rename

- rename(newName: any): any

- - Defined in collection/Collection.ts:1070

  #### Parameters

  - ##### newName: any

  #### Returns any

### restore

- restore(backupID: any, callback: any): Promise<String>

- - Defined in collection/Collection.ts:981

  #### Parameters

  - ##### backupID: any

  - ##### callback: any

  #### Returns Promise<String>

### save

- save(doc: any, options: any, callback?: any): Promise<any>

- - Defined in collection/Collection.ts:852

  Insert or update a document. If the document has an "_id" is an update (with upsert), if not is an insert.

  #### Parameters

  - ##### doc: any

    Document to be inserted/updated

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<any>

  Returns a promise with the inserted document or the update information

### update

- update(selection: any, update: any, options: any, callback?: any): Promise<any>

- - Defined in collection/Collection.ts:437

  Updates one or many documents

  #### Parameters

  - ##### selection: any

  - ##### update: any

  - ##### options: any

  - ##### Optional callback: any

  #### Returns Promise<any>

  Returns a promise with the update/insert (if upsert=true) information

### Static checkCollectionName

- checkCollectionName(collectionName: any): void

- - Defined in collection/Collection.ts:121
  ignore

  #### Parameters

  - ##### collectionName: any

  #### Returns void

## Object literals

### Static _noCreateModifiers

_noCreateModifiers: object

- Defined in collection/Collection.ts:110

ignore

### $pop

$pop: boolean = true

- Defined in collection/Collection.ts:112

### $pull

$pull: boolean = true

- Defined in collection/Collection.ts:114

### $pullAll

$pullAll: boolean = true

- Defined in collection/Collection.ts:115

### $rename

$rename: boolean = true

- Defined in collection/Collection.ts:113

### $unset

$unset: boolean = true

- Defined in collection/Collection.ts:111

Generated using TypeDoc