Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28761

Implement UpdateObjectNode::apply()

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.8
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Fully Compatible
    • Query 2017-05-29

      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.

            Assignee:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: