Tutorials Exercises Get Certified Services Menu
Log in
Sign Up Spaces Bootcamps

MongoDB Aggregation $limit

Aggregation $limit

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


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

db.movies.aggregate([ { $limit: 1 } ])
Try it Yourself »

This will return the 1 movie from the collection.