Aggregation $limit
This aggregation stage limits the number of documents passed to the next stage.
Example
db.movies.aggregate([ { $limit: 1 } ])
This will return the 1 movie from the collection.
This aggregation stage limits the number of documents passed to the next stage.
db.movies.aggregate([ { $limit: 1 } ])
This will return the 1 movie from the collection.
Join CodingNow 2.0's MongoDB course — live mentorship, real projects, and 100% placement support.
Enroll Now — Free Demo AvailableQuick answers about learning $limit in MongoDB.