Aggregation task - $limit
A scope aggregation task that specifies the maximum number of rows to be retrieved.
The $limit function corresponds to the
'fetch first n rows' of a SQL query.
Syntax diagram
Command arguments
- size
- An integer number to specify the number of documents that are returned with this query.
Example
Example 1
db.books.aggregate({"$limit": 3})