Articles → MONGODB → $Limit And $Skip Aggregation Stages In Mongodb$Limit And $Skip Aggregation Stages In MongodbIn this article, we will discuss the $limit and $skip aggregation stages in MongoDB.Purpose The $limit stage is used to restrict the number of documents to a specified number of times.The $skip stage is used to skip the number of documents to a specified number of times.Example Consider the following document: -To limit the document, write the following query: -db.orders.aggregate([ { $limit: 2 } ])To skip the documents, write the following query: -db.orders.aggregate([ { $skip: 2 } ])Posted By - Karan Gupta Posted On - Monday, June 10, 2024 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
db.orders.aggregate([ { $limit: 2 } ])
db.orders.aggregate([ { $skip: 2 } ])
Query/Feedback