0
0
MongoDBquery~10 mins

How MongoDB scans documents - Interactive Practice

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 collection.

MongoDB
db.collection.[1]({})
Drag options to blanks, or click blank then click option'
Adelete
Binsert
Cupdate
Dfind
Attempts:
3 left
💡 Hint
Common Mistakes
Using insert instead of find
Using update instead of find
2fill in blank
medium

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

MongoDB
db.collection.find({}).[1](5)
Drag options to blanks, or click blank then click option'
Alimit
Bskip
Ccount
Dsort
Attempts:
3 left
💡 Hint
Common Mistakes
Using skip instead of limit
Using count instead of limit
3fill in blank
hard

Fix the error in the code to find documents where age is greater than 30.

MongoDB
db.collection.find({ age: { [1]: 30 } })
Drag options to blanks, or click blank then click option'
A$gt
B$eq
C$lt
D$ne
Attempts:
3 left
💡 Hint
Common Mistakes
Using $lt instead of $gt
Using $eq instead of $gt
4fill in blank
hard

Fill both blanks to find documents where status is 'active' and sort by age ascending.

MongoDB
db.collection.find({ status: [1] }).[2]({ age: 1 })
Drag options to blanks, or click blank then click option'
A'active'
Blimit
Csort
D'inactive'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'inactive' instead of 'active'
Using limit instead of sort
5fill in blank
hard

Fill all three blanks to find documents where score is greater than 80, limit to 3, and sort by score descending.

MongoDB
db.collection.find({ score: { [1]: 80 } }).[2](3).[3]({ score: -1 })
Drag options to blanks, or click blank then click option'
A$gt
Blimit
Csort
D$lt
Attempts:
3 left
💡 Hint
Common Mistakes
Using $lt instead of $gt
Using sort before limit
Using 1 instead of -1 for descending