Implement the following method:
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.