Complete the code to find documents where age is 25 and city is 'New York'.
db.users.find({ age: 25, city: [1] })The query uses implicit AND by listing multiple fields inside the same object. Here, city must be 'New York'.
Complete the code to find documents where status is 'active' and score is greater than 80.
db.players.find({ status: 'active', score: { [1]: 80 } })The operator $gt means 'greater than'. So score must be greater than 80.
Fix the error in the query to find documents where type is 'admin' and active is true.
db.accounts.find({ type: [1], active: true })String values in MongoDB queries must be quoted. So 'admin' is correct.
Fill both blanks to find documents where price is less than 100 and inStock is true.
db.products.find({ price: { [1]: [2] }, inStock: true })$lt means less than, so price must be less than 100. inStock is already true.
Fill all three blanks to find documents where category is 'books', rating is greater than 4, and available is false.
db.items.find({ category: [1], rating: { [2]: [3] }, available: false })Category must be 'books' (string quoted), rating greater than 4 ($gt: 4), and available false.