Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to find documents where age is 25 using an index.
MongoDB
db.users.find({ age: [1] }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers causes type mismatch.
Using nested objects incorrectly in the query.
✗ Incorrect
The query needs the value 25 directly to match the age field.
2fill in blank
mediumComplete the query to find documents where age is 25 and status is 'A' using index intersection.
MongoDB
db.users.find({ age: 25, status: [1] }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting string values causes errors.
Using nested objects unnecessarily.
✗ Incorrect
The status value must be a string, so it needs quotes.
3fill in blank
hardFix the error in the query to use index intersection for age and status.
MongoDB
db.users.find({ age: [1], status: "A" }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string '25' instead of number 25.
Using nested objects incorrectly.
✗ Incorrect
Age should be a number, not a string or nested object.
4fill in blank
hardFill both blanks to create a query that uses index intersection for age and status.
MongoDB
db.users.find({ age: [1], status: [2] }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up numbers and strings.
Using wrong values for age or status.
✗ Incorrect
The query filters age by 25 (number) and status by "A" (string).
5fill in blank
hardFill all three blanks to create a query that uses index intersection for age, status, and score.
MongoDB
db.users.find({ age: [1], status: [2], score: [3] }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Quoting numbers or not quoting strings.
Using wrong values for fields.
✗ Incorrect
The query filters age by 25 (number), status by "A" (string), and score by 85 (number).