Cursors
- Mongodb returns query results in batches using cursors.
- Cursor are a pointer to a result set on the server.
- Default batch size is usually 101 documents.
Cursor Methods
- count()
shop> db.products.find().count()
10355
- limit()
shop> db.products.find().limit(5)
- skip()
shop> db.products.find().limit(5).skip(2)
- sort() Price in ascending order
shop> db.products.find().sort({price: 1})
Price in descending order
shop> db.products.find().sort({price: -1})