Complete the code to find documents where the field 'age' is NOT equal to 30.
db.collection.find({ age: { $not: { $eq: [1] } } })The $not operator negates the condition inside it. Here, { $eq: 30 } means age equals 30, so $not finds ages not equal to 30.
Complete the code to find documents where the 'status' field does NOT start with the letter 'A'.
db.collection.find({ status: { $not: { $regex: /^[1]/ } } })The regular expression /^A/ matches strings starting with 'A'. Using $not negates this, so it finds strings not starting with 'A'.
Fix the error in the query to find documents where 'score' is NOT greater than 50.
db.collection.find({ score: { $not: { $gt: [1] } } })$gt changes the meaning.$not: 50 directly, which is invalid.The query uses $gt: 50 to find scores greater than 50. $not negates this, so it finds scores less than or equal to 50.
Fill both blanks to find documents where 'category' is NOT 'electronics' and 'price' is NOT less than 100.
db.collection.find({ category: { $not: { $eq: "[1]" } }, price: { $not: { $lt: [2] } } })The query excludes documents where category equals 'electronics' and price is less than 100 by negating those conditions with $not.
Fill all three blanks to find documents where the 'name' field does NOT contain 'Pro', 'rating' is NOT equal to 5, and 'stock' is NOT less than 10.
db.collection.find({ name: { $not: { $regex: [1] } }, rating: { $not: { $eq: [2] } }, stock: { $not: { $lt: [3] } } })The regex /Pro/i matches 'Pro' case-insensitively. Using $not excludes names containing 'Pro'. Similarly, $not excludes ratings equal to 5 and stock less than 10.