Aggregation $limit

This aggregation stage limits the number of documents passed to the next stage.

Example

In this example, we are using the "sample_mflix" database loaded from our sample data in the section.

db.movies.aggregate([ { $limit: 1 } ])

This will return the 1 movie from the collection.


 
$limit

Login
ADS CODE