Grokking MongoDB
0% completed
Field Update Operators
An update does not have to rewrite a whole document. You name the fields you want to change and say what should happen to each one, and the server leaves every other field as it was. The instructions you use for this are called field update operators.
| Operator | What it does to the field |
|---|---|
$set | Sets its value, and creates the field if it is missing |
$unset | Removes it |
$inc | Adds an amount to it |
$mul | Multiplies it by an amount |
An update has a filter, an update document that holds the operators, and optional settings.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%