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.
-
query
(String|ObjectId|Object): The query for the count. -
[
options
] (object) -
[
callback
] (function)
A promise
users.count({name: 'foo'})
users.count('id') // a bit useless but consistent with the rest of the API