Grokking MongoDB
Vote

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.

OperatorWhat it does to the field
$setSets its value, and creates the field if it is missing
$unsetRemoves it
$incAdds an amount to it
$mulMultiplies 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%


Vote for new content