Complete the code to find all documents in the 'users' collection.
db.users.[1]()The find() method retrieves documents from a collection. Other methods like insert(), update(), and delete() modify data instead.
Complete the code to limit the number of documents returned to 5.
db.users.find().[1](5)
The limit() method restricts the number of documents returned. skip() skips documents, sort() orders them, and count() returns the number of documents.
Fix the error in the code to sort users by age in ascending order.
db.users.find().[1]({ age: 1 })
The sort() method orders documents. Using sort({ age: 1 }) sorts by age ascending. Other methods do not order results.
Fill both blanks to skip the first 3 documents and limit the results to 4.
db.users.find().[1](3).[2](4)
skip(3) skips the first 3 documents, and limit(4) limits the output to 4 documents. This combination controls which results you see.
Fill all three blanks to find users older than 25, sort by name ascending, and limit to 3 results.
db.users.find({ age: { [1]: 25 } }).[2]({ name: 1 }).[3](3)$gt means 'greater than' to filter ages above 25. sort({ name: 1 }) orders by name ascending. limit(3) restricts results to 3 documents.