Complete the code to update all documents where age is greater than 25.
db.collection.updateMany({ age: { $[1]: 25 } }, { $set: { status: "active" } })The $gt operator means 'greater than', so it selects documents where age is more than 25.
Complete the code to set the field "verified" to true for all users with status "pending".
db.users.updateMany({ status: "[1]" }, { $set: { verified: true } })We want to update users whose status is exactly "pending".
Fix the error in the updateMany query to increment the "score" field by 10 for all documents.
db.scores.updateMany({}, { $[1]: { score: 10 } })The $inc operator increments a numeric field by the specified value.
Fill both blanks to update the "status" to "archived" for documents where "lastLogin" is less than 2020.
db.accounts.updateMany({ lastLogin: { $[1]: 2020 } }, { $[2]: { status: "archived" } })$lt means less than, so it selects documents with lastLogin before 2020. $set updates the status field.
Fill all three blanks to increment the "visits" by 1 for users with "role" equal to "member".
db.users.updateMany({ role: "[1]" }, { $[2]: { visits: [3] } })We select users with role "member". Then we use $inc to add 1 to the visits field.