Complete the code to update the age of a user to 30.
db.users.updateOne({name: "Alice"}, {$set: {age: [1])The $set operator updates the field to the given value. Here, age is set to 30 as a number.
Complete the code to update all documents where status is 'pending' to have status 'complete'.
db.orders.updateMany({status: "pending"}, {$set: {status: [1])The $set operator changes the status field to the string "complete" for all matching documents.
Fix the error in the update code to increment the score by 5.
db.players.updateOne({name: "Bob"}, {$inc: {score: [1])The $inc operator increments the score by the number 5. It must be a number, not a string.
Fill both blanks to update the user's city to 'Seattle' and add a new field 'verified' set to true.
db.users.updateOne({name: "Carol"}, {$set: {city: [1], verified: [2])The city field is updated to the string "Seattle" and the verified field is added with the boolean value true.
Fill all three blanks to update the product price to 19.99, increase stock by 10, and set available to true.
db.products.updateOne({productId: 123}, {$set: {price: [1], available: [2], $inc: {stock: [3])The price is set to 19.99, available is set to true, and stock is incremented by 10.