Complete the code to increment the field 'score' by 1 in a MongoDB update.
db.collection.updateOne({ _id: 1 }, { [1]: { score: 1 } })The $inc operator increments the value of a field by the specified amount.
Complete the code to increment the 'views' field by 5 in a MongoDB update.
db.collection.updateOne({ _id: 2 }, { [1]: { views: 5 } })$inc adds the specified number to the current value of the field.
Fix the error in the update code to increment 'likes' by 3.
db.collection.updateOne({ _id: 3 }, { $inc: { likes: [1] } })The increment value must be a number, not a string or boolean.
Fill both blanks to increment 'count' by 2 and 'score' by 10 in one update.
db.collection.updateOne({ _id: 4 }, { [1]: { count: 2, [2]: 10 } })Use $inc to increment fields. The second blank is the field name 'score'.
Fill all three blanks to increment 'likes' by 1, 'views' by 5, and 'shares' by 2 in one update.
db.collection.updateOne({ _id: 5 }, { [1]: { likes: [2], views: [3], shares: 2 } })Use $inc to increment fields. The values 1 and 5 are the amounts to add to 'likes' and 'views'.
