Navigation
This version of the documentation is archived and no longer supported.

Update Operators

On this page

Update Operators

Fields

Name Description
$inc Increments the value of the field by the specified amount.
$rename Renames a field.
$setOnInsert Sets the value of a field upon document creation during an upsert. Has no effect on update operations that modify existing documents.
$set Sets the value of a field in an existing document.
$unset Removes the specified field from an existing document.

Array

Operators

Name Description
$ Acts as a placeholder to update the first element that matches the query condition in an update.
$addToSet Adds elements to an existing array only if they do not already exist in the set.
$pop Removes the first or last item of an array.
$pullAll Removes all matching values from an array.
$pull Removes items from an array that match a query statement.
$pushAll Deprecated. Adds several items to an array.
$push Adds an item to an array.

Modifiers

Name Description
$each Modifies the $push and $addToSet operators to append multiple items for array updates.
$slice Modifies the $push operator to limit the size of updated arrays.
$sort Modifies the $push operator to reorder documents stored in an array.

Bitwise

Name Description
$bit Performs bitwise AND and OR updates of integer values.

Isolation

Name Description
$isolated Modifies the behavior of a write operation to increase the isolation of the operation.