Complete the code to update the age of a user named 'Alice' to 30.
db.users.updateOne({name: 'Alice'}, {$set: {age: [1])The $set operator updates the specified field. Here, we set age to 30.
Complete the code to increment the score of a player named 'Bob' by 10.
db.players.updateOne({name: 'Bob'}, {$inc: {score: [1])$set instead of $inc.The $inc operator increases the value of the field by the specified amount. Here, we increment score by 10.
Fix the error in the update code to add a new tag 'urgent' to the tags array for task with id 123.
db.tasks.updateOne({_id: 123}, {$push: {tags: [1])Strings in MongoDB update queries must be quoted. So, 'urgent' is correct to add the tag.
Fill both blanks to update the price to 19.99 and set the status to 'available' for product with id 456.
db.products.updateOne({_id: 456}, {$set: {price: [1], status: [2])Price is a number so no quotes needed. Status is a string and must be quoted.
Fill all three blanks to update the user's email, increment login count by 1, and add 'premium' to roles array for user with username 'jane'.
db.users.updateOne({username: 'jane'}, {$set: {email: [1], $inc: {logins: [2], $push: {roles: [3])Email is a string and must be quoted. Login increment is numeric. Role added is a string and must be quoted.