Complete the code to limit the number of documents returned to 5.
db.collection.find().[1](5)
The limit() method restricts the number of documents returned by the query. Here, it limits the result to 5 documents.
Complete the code to skip the first 10 documents and then limit the result to 5 documents.
db.collection.find().skip(10).[1](5)
After skipping the first 10 documents, limit(5) returns the next 5 documents for pagination.
Fix the error in the code to correctly paginate by skipping 20 documents and limiting to 10.
db.collection.find().skip(20).[1](10)
The limit() method should come after skip() to correctly paginate. The correct order is skip(20).limit(10).
Fill both blanks to skip the first 15 documents and limit the result to 7 documents.
db.collection.find().[1](15).[2](7)
To paginate, first skip the documents you don't want, then limit how many you want to see.
Fill all three blanks to sort documents by 'date' descending, skip 30 documents, and limit to 10 documents.
db.collection.find().[1]({ date: -1 }).[2](30).[3](10)
First, sort documents by date descending. Then skip 30 documents and limit the result to 10 for pagination.