Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using $lt which means 'less than'.
Using $eq which means 'equal to'.
✗ Incorrect
The $gt operator means 'greater than'. So this query finds documents with age > 25.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
The $gte operator means 'greater than or equal to'. This query finds documents with score >= 80.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the colon after the operator.
Using $lt: which means less than.
✗ Incorrect
The operator must be followed by a colon ':' inside the object. $gt: 100 means price > 100.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using $gte instead of $gt for strict greater than.
Using $lte instead of $lt for strict less than.
✗ Incorrect
Use $gt for greater than 10 and $lt for less than 50 to find quantity between 10 and 50.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up $gt and $gte operators.
Using $lte instead of $lt for price.
✗ Incorrect
Use $gte for rating >= 4, $lt for price < 100, and $gt for stock > 0.