0
0
MongoDBquery~10 mins

$gt and $gte for greater than in MongoDB - Interactive Code Practice

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

Complete the code to find documents where the age is greater than 25.

MongoDB
db.collection.find({ age: { [1]: 25 } })
Drag options to blanks, or click blank then click option'
A$gt
B$lt
C$eq
D$ne
Attempts:
3 left
💡 Hint
Common Mistakes
Using $lt which means 'less than'.
Using $eq which means 'equal to'.
2fill in blank
medium

Complete the code to find documents where the score is greater than or equal to 80.

MongoDB
db.collection.find({ score: { [1]: 80 } })
Drag options to blanks, or click blank then click option'
A$ne
B$lte
C$gte
D$lt
Attempts:
3 left
💡 Hint
Common Mistakes
Using $lt or $lte which mean less than or less than or equal.
Using $ne which means not equal.
3fill in blank
hard

Fix the error in the query to find documents where price is greater than 100.

MongoDB
db.collection.find({ price: { [1] 100 } })
Drag options to blanks, or click blank then click option'
A$gt:
B$lt:
C$gte:
D$eq:
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the colon after the operator.
Using $lt: which means less than.
4fill in blank
hard

Fill both blanks to find documents where quantity is greater than 10 and less than 50.

MongoDB
db.collection.find({ quantity: { [1]: 10, [2]: 50 } })
Drag options to blanks, or click blank then click option'
A$gt
B$gte
C$lt
D$lte
Attempts:
3 left
💡 Hint
Common Mistakes
Using $gte instead of $gt for strict greater than.
Using $lte instead of $lt for strict less than.
5fill in blank
hard

Fill all three blanks to find documents where rating is greater than or equal to 4, price is less than 100, and stock is greater than 0.

MongoDB
db.collection.find({ rating: { [1]: 4 }, price: { [2]: 100 }, stock: { [3]: 0 } })
Drag options to blanks, or click blank then click option'
A$gt
B$lt
C$gte
D$lte
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up $gt and $gte operators.
Using $lte instead of $lt for price.