Skip to content

Latest commit

 

History

History
108 lines (54 loc) · 2.43 KB

collection.md

File metadata and controls

108 lines (54 loc) · 2.43 KB

Collection

Methods

collection.find(query = {}, projection = null, opts = null)

Returns Cursor

collection.findOne(query = {}, projection = null)

Returns Promise<Object>

collection.findAndModify(opts)

Returns Promise<any>

collection.count(query = {})

Returns Promise<number>

collection.distinct(field, query)

Returns Promise<Array<Object>>

collection.insert(docOrDocs, opts = {})

Returns Promise<Array<Object>|Object>

collection.update(query, update, opts = {})

Returns Promise<Object>

collection.save(doc, opts = {})

Returns Promise<Object>

collection.remove(query = {}, opts = {"justOne":false})

Returns Promise<Object>

collection.rename(name, opts = {})

Returns Promise<void>

collection.drop()

Returns Promise<void>

collection.stats()

Returns Promise<any>

collection.mapReduce(map, reduce, opts = {})

Returns Promise<any>

collection.runCommand(cmd, opts = {})

Returns Promise<any>

collection.toString()

Returns string

collection.dropIndexes()

Returns Promise<void>

collection.dropIndex(index)

Returns Promise<void>

collection.createIndex(index, opts = {})

Returns Promise<void>

collection.ensureIndex(index, opts = {})

Returns Promise<void>

collection.getIndexes()

Returns Promise<Array<Object>>

collection.reIndex()

Returns Promise<void>

collection.isCapped()

Returns Promise<boolean>

collection.group(doc)

Returns Promise<Array<Object>>

collection.aggregate(...pipeline)

Returns Cursor

collection.initializeOrderedBulkOp(opts = {})

Returns Bulk

collection.initializeUnorderedBulkOp(opts = {})

Returns Bulk