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

Create UpdateArrayNode

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

      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.

            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: