OPTIONS

Array Update Operators

Update 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 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 all array elements that match a specified query.
$pushAll Deprecated. Adds several items to an array.
$push Adds an item to an array.

Update Operator 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.
$position Modifies the $push operator to specify the position in the array to add elements.
←   $currentDate $ (update)  →

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.