- Reference >
- Query, Update, Projection, and Aggregation Operators >
- $limit (aggregation)
$limit (aggregation)¶
-
$limit
¶ Restricts the number of documents that pass through the
$limit
in the pipeline.$limit
takes a single numeric (positive whole number) value as a parameter. Once the specified number of documents pass through the pipeline operator, no more will. Consider the following example:This operation returns only the first 5 documents passed to it from by the pipeline.
$limit
has no effect on the content of the documents it passes.