Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to find documents where the age is less than 30.
MongoDB
db.users.find({ age: { [1]: 30 } }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using $gt instead of $lt will find documents with age greater than 30.
Using $eq will find documents with age exactly 30, not less than 30.
✗ Incorrect
The $lt operator selects documents where the value is less than the specified value.
2fill in blank
mediumComplete the code to find documents where the score is less than or equal to 85.
MongoDB
db.scores.find({ score: { [1]: 85 } }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using $lt will exclude documents where score equals 85.
Using $gt or $ne will not find documents with score less than or equal to 85.
✗ Incorrect
The $lte operator selects documents where the value is less than or equal to the specified value.
3fill in blank
hardFix the error in the query to find documents where price is less than 100.
MongoDB
db.products.find({ price: { [1]: 100 } }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the colon after the operator causes syntax errors.
Using $gt instead of $lt changes the query logic.
✗ Incorrect
The operator must be followed by a colon ':' to form a valid key-value pair in the query object.
4fill in blank
hardFill both blanks to find documents where quantity is less than 50 and price is less than or equal to 20.
MongoDB
db.inventory.find({ quantity: { [1]: 50 }, price: { [2]: 20 } }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up $gt and $lt changes the query logic.
Using $eq will only match exact values, not ranges.
✗ Incorrect
Use $lt for less than and $lte for less than or equal to in the respective fields.
5fill in blank
hardFill all three blanks to find documents where age is less than 40, score is less than or equal to 90, and height is less than 180.
MongoDB
db.people.find({ age: { [1]: 40 }, score: { [2]: 90 }, height: { [3]: 180 } }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using $gt instead of $lt or $lte reverses the condition.
Using $eq only matches exact values, not ranges.
✗ Incorrect
Use $lt for less than and $lte for less than or equal to as per the conditions for each field.