Complete the code to delete all documents where the field "status" is "inactive".
db.collection.deleteMany({ status: [1] })deleteOne instead of deleteMany.The deleteMany method deletes all documents matching the filter. Here, we want to delete documents where status equals "inactive".
Complete the code to delete all documents where the "age" field is greater than 30.
db.collection.deleteMany({ age: { [1]: 30 } })$lt which means less than.$eq which means equal.The $gt operator means "greater than". This filter deletes documents where age is greater than 30.
Fix the error in the code to delete documents where "score" is less than or equal to 50.
db.collection.deleteMany({ score: { [1]: 50 } })$gte which means greater than or equal.$eq which means equal only.The operator $lte means "less than or equal to". It correctly filters documents with score less than or equal to 50.
Fill both blanks to delete documents where "category" is "books" and "price" is less than 20.
db.collection.deleteMany({ category: [1], price: { [2]: 20 } })$gt instead of $lt.The filter deletes documents with category equal to "books" and price less than 20 using $lt.
Fill all three blanks to delete documents where "status" is "pending", "priority" is greater than 3, and "assigned" is false.
db.collection.deleteMany({ status: [1], priority: { [2]: 3 }, assigned: [3] })true instead of false for assigned.This filter deletes documents where status is "pending", priority is greater than 3 using $gt, and assigned is false.