In MongoDB the db.collection.count()
method returns the count of documents that would match a find()
query for the collection or view.
The collection
part is the name of the collection or view to perform the count operation on.
Note that it doesn’t actually perform a find()
operation. It simply counts and returns the number of results that match a query.