Skip to content

Latest commit

 

History

History
24 lines (14 loc) · 694 Bytes

count.md

File metadata and controls

24 lines (14 loc) · 694 Bytes

collection.count

Mongo documentation

Returns the count of documents that would match a find() query. The collection.count() method does not perform the find() operation but instead counts and returns the number of results that match a query.

Arguments

  1. query (String|ObjectId|Object): The query for the count.

  2. [options] (object)

  3. [callback] (function)

Returns

A promise

Example

users.count({name: 'foo'})
users.count('id') // a bit useless but consistent with the rest of the API