Docs Menu

Array Update Operators

On this page

  • Update Operators
  • Update Operator Modifiers
Note

For details on specific operator, including syntax and examples, click on the specific operator to go to its reference page.

Name
Description
Acts as a placeholder to update the first element that matches the query condition.
Acts as a placeholder to update all elements in an array for the documents that match the query condition.
Acts as a placeholder to update all elements that match the arrayFilters condition for the documents that match the query condition.
Adds elements to an array only if they do not already exist in the set.
Removes the first or last item of an array.
Removes all array elements that match a specified query.
Adds an item to an array.
Removes all matching values from an array.
Name
Description
Modifies the $push and $addToSet operators to append multiple items for array updates.
Modifies the $push operator to specify the position in the array to add elements.
Modifies the $push operator to limit the size of updated arrays.
Modifies the $push operator to reorder documents stored in an array.
←  $unset$ (update) →
Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.