Complete the code to delete all documents where the field "status" is "inactive".
db.collection.deleteMany({"status": [1] })The deleteMany method requires a filter object. To delete documents where the status is "inactive", you must specify {"status": "inactive"}.
Complete the code to delete a single document where the "username" is "guest".
db.users.[1]({"username": "guest"})
The deleteOne method deletes only the first document that matches the filter. Here, it deletes one user with username "guest".
Fix the error in the delete operation to avoid deleting all documents unintentionally.
db.orders.deleteMany([1])Using an empty filter {} deletes all documents. To avoid this, specify a filter like {"status": "pending"} to delete only matching documents.
Fill both blanks to delete documents where "age" is greater than 30 and "active" is false.
db.users.deleteMany({"age": { [1]: 30 }, "active": [2] })To delete users older than 30, use "$gt" (greater than). To check if "active" is false, use the boolean false.
Fill all three blanks to delete documents where "score" is less than 50, "passed" is false, and "grade" is "F".
db.results.deleteMany({"score": { [1]: 50 }, "passed": [2], "grade": [3] })Use "$lt" to find scores less than 50, boolean false for "passed", and string "F" for grade.