0
0
MongoDBquery~10 mins

Why result control matters in MongoDB - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to find all documents in the 'users' collection.

MongoDB
db.users.[1]()
Drag options to blanks, or click blank then click option'
Afind
Binsert
Cupdate
Ddelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' instead of 'find' to get data.
Trying to update or delete when just reading data.
2fill in blank
medium

Complete the code to limit the number of documents returned to 5.

MongoDB
db.users.find().[1](5)
Drag options to blanks, or click blank then click option'
Askip
Bcount
Climit
Dsort
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'skip' to limit results instead of 'limit'.
Using 'count' which returns a number, not documents.
3fill in blank
hard

Fix the error in the code to sort users by age in ascending order.

MongoDB
db.users.find().[1]({ age: 1 })
Drag options to blanks, or click blank then click option'
Alimit
Bsort
Cskip
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'limit' or 'skip' to order results.
Using 'count' which returns a number, not sorted documents.
4fill in blank
hard

Fill both blanks to skip the first 3 documents and limit the results to 4.

MongoDB
db.users.find().[1](3).[2](4)
Drag options to blanks, or click blank then click option'
Askip
Blimit
Csort
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of skip and limit.
Using 'sort' or 'count' instead of skip or limit.
5fill in blank
hard

Fill all three blanks to find users older than 25, sort by name ascending, and limit to 3 results.

MongoDB
db.users.find({ age: { [1]: 25 } }).[2]({ name: 1 }).[3](3)
Drag options to blanks, or click blank then click option'
A$gt
Bsort
Climit
D$lt
Attempts:
3 left
💡 Hint
Common Mistakes
Using '$lt' instead of '$gt' for filtering.
Mixing up the order of sort and limit.
Forgetting to use a filter operator.