Complete the code to find documents where the field 'age' is exactly 30.
db.users.find({"age": [1])The query looks for documents where the 'age' field equals the number 30. Using 30 directly matches the numeric value.
Complete the code to find documents where the 'name' field starts with 'A'.
db.users.find({"name": [1])The regular expression /^A/ matches strings starting with 'A'. This is the correct way to query for names starting with 'A' in MongoDB.
Fix the error in the query to find documents where 'score' is greater than 50.
db.scores.find({"score": { [1] 50 } })The operator $gt means 'greater than'. It must be used as a key in an object to compare values.
Fill both blanks to create a query that finds documents where 'status' is 'active' and 'age' is less than 40.
db.users.find({"status": [1], "age": { [2] 40 } })The 'status' field should match the string 'active'. The 'age' field uses the $lt operator to find values less than 40.
Fill all three blanks to create a query that finds documents where the 'category' is 'books', 'price' is greater than 20, and 'inStock' is true.
db.products.find({"category": [1], "price": { [2] 20 }, "inStock": [3])The 'category' field matches the string 'books'. The 'price' field uses $gt to find prices greater than 20. The 'inStock' field is a boolean true.