Single-purpose aggregation operators are available so that you can operate on a collection or a cursor. The following table summarizes the operators which can operate on a collection:
db.collection.count() | Wraps the $count aggregation operator to produce the number of documents in a collection. |
db.collection.distinct() |
Wrapper for the distinct command (https://docs.mongodb.com/manual/reference/command/distinct/#distinct). Produces distinct values for document fields across a collection. |
The following table summarizes single-purpose aggregation operations which can be performed on a cursor (such as the iteration returned after executing db.collection.find()):
cursor.count() | Equivalent to db.collection.count() (see prior table) |
cursor.limit() | Limits the number of documents in the final result |
cursor.sort() | Returns the results in... |