More Update Operators
$inc adds to numbers, $unset removes fields, $rename renames, $min and $max keep the smaller or larger and $currentDate sets the date.
Example
db.students.updateOne({ name: "Ada" }, {
$inc: { points: 5 },
$unset: { temp: "" },
$rename: { nick: "alias" },
$currentDate: { updated: true }
})Exercise
Add 5.
{ $: { points: 5 } }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.