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

Implement UpdateObjectNode::apply()

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.5.8
    • Querying
    • None
    • Fully Compatible
    • Query 2017-05-29

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: