Articles → MONGODB → Limit Method In MongodbLimit Method In MongodbIn this article, we will discuss the limit() method in MongoDB.Purpose The limit() method is used to limit the number of documents returned in a query result.Example Consider the following collection: -We are required to get only 2 documents from the collection. For that, we will use the following query: -db.[collection].find().limit(2)Output Posted By - Karan Gupta Posted On - Tuesday, March 19, 2024 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
db.[collection].find().limit(2)
Query/Feedback