- limit
db.people.find().limit(2)
Use : It is used in Pagination Pagination is a technique used in database queries (and in web applications generally) to divide a large dataset into smaller, more manageable chunks or "pages." This allows users to retrieve and view a portion of the data at a time rather than loading the entire dataset in a single query.
- Achieving pagination using Mongodb find and limit
- Skip : skips the specified number of documents
db.people.find().skip(1)
3.sort
db.people.find().sort({age:1})
1 → ascending order
db.people.find().sort({age: -1})
-1 → descending order