Create UpdateArrayNode and implement all methods. Include UpdateArrayNode in parsing and UpdateNode::mergeTrees().
Notes on parsing:
- We fail to parse if we try to make an UpdateArrayNode in the same position as a node of a different type.
- Each <id> used in an array update must have an arrayFilter and vice versa.
Notes on UpdateNode::mergeTrees():
- It is an error to merge an UpdateArrayNode with a node of a different type.
Notes on UpdateArrayNode::apply():
- We require that pathToCreate be empty and element be an array (i.e. the array existed in the document prior to update). For each element of the array, use the arrayFilters to determine the set of children to apply to the element. If only one child matches, call apply() on that child. If multiple children match, clone and merge the children, and call apply() on the result. The merged set of children should be stored and reused for other array elements and other documents.
- indexesAffected and noop are computed by OR-ing and AND-ing the results of the children, respectively.
- First apply the array filters to determine how many elements are matched. Then if only one element was matched, pass logBuilder on to the child when calling apply(). Otherwise, do not pass the logBuilder on to the children when calling apply(). If multiple children were modified (not noops), record the entire array as a $set. If one element was modified, record that element as a $set. If no elements were modified, do not write to logBuilder.
- depends on
-
SERVER-28757 Create BSONElementViewMatchableDocument
- Closed
-
SERVER-28758 Implement UpdateNode::mergeTrees()
- Closed
- is depended on by
-
SERVER-28779 Allow $[] syntax for specifying array indexes in updates
- Backlog
-
SERVER-28777 Always parse update expression as an UpdateNode tree when featureCompatibilityVersion=3.6
- Closed
-
SERVER-28778 Multiversion testing for array updates
- Closed