Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

MongoDB Aggregation $limit


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 Intro to Aggregations section.

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

This will return the 1 movie from the collection.