Single Purpose Aggregation Methods

The single purpose aggregation methods aggregate documents from a single collection. The methods are simple but lack the capabilities of an aggregation pipeline.

MethodDescription
db.collection.estimatedDocumentCount()Returns an approximate count of the documents in a collection or a view.
db.collection.count()Returns a count of the number of documents in a collection or a view.
db.collection.distinct()Returns an array of documents that have distinct values for the specified field.

Backlinks