Explore Related Tools
Hand-picked utilities and calculators related to this tool.
When you run `find()`, MongoDB returns a Cursor. You can chain various methods to this cursor to modify the result set.
Specifies the maximum number of documents the cursor will return.
db.users.find().limit(5)Specifies the number of documents to skip before returning the result.
db.users.find().skip(10)Pagination is the most common use case for these methods.
// Page 1 (items 1-10)
db.users.find().limit(10)
// Page 2 (items 11-20)
db.users.find().skip(10).limit(10)
// Page 3 (items 21-30)
db.users.find().skip(20).limit(10)Returns the count of documents that match the query criteria.
db.users.countDocuments({ status: "active" })In scripts or shell, you can manually iterate through a cursor.
const myCursor = db.users.find();
while (myCursor.hasNext()) {
printjson(myCursor.next());
}Hand-picked utilities and calculators related to this tool.
