Implement the following method:
Status apply(mutablebson::Element element,
FieldRef pathToCreate,
FieldRef pathTaken,
StringData matchedField,
UpdateIndexData indexData,
LogBuilder* logBuilder,
bool* indexesAffected,
bool* noop) final;
This should iterate through each of the node's children, recursively calling apply() on each child. If pathToCreate is empty and the child’s field exists in the current element, it passes that field as element. Otherwise, it appends the field to the end of pathToCreate and passes the entire current element as element. If the field is "$", it is replaced with matchedField. If there was already a child matchedField, the children must be cloned and merged using UpdateNode::mergeTrees(), and apply() called on the result. Before moving on to the next child, it checks whether the fields along pathToCreate were created, and if so, it resets element to the end of pathToCreate and resets pathToCreate to “”.
indexesAffected and noop are computed by OR-ing and AND-ing the results of the children, respectively. logBuilder is simply forwarded to children.
- depends on
-
SERVER-28758 Implement UpdateNode::mergeTrees()
- Closed
-
SERVER-28759 Implement SetNode::apply()
- Closed
- is depended on by
-
SERVER-28762 Conditionally parse an update expression as an UpdateNode tree
- Closed