Handle path modifications which ensure the prefix is object

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Some operations ensure the prefix of the path is an object.

      $lookup: {as: “a.b”} -> recreates a.b as objects if they are arrays, because it uses setNestedField

      Enterprise test> db.test.aggregate([{$set: {b: [{c: []}]}}, {$lookup: {pipeline: [{$documents: []}], as: 'b.c.d'}}])
        { a: 2, b: { c: { d: [] } } }
      Enterprise test> db.test.aggregate([{$set: {b: [{c: []}]}}, {$set: {'b.c.d': []}}])
        { a: 2, b: [ { c: [] } ] } 

      If the prefix contains arrays, the arrays are replaced with objects (contents discarded).

      We should handle this correctly in the graph.

      If we do not, we will incorrectly report that $lookup with as:"a.b" does not modify "a.c" when actually, if "a" is an array, it will be discarded, thus "a.c" is modified.

      This requires a change in describeTransformation and the graph code.

            Assignee:
            Vesko Karaganev
            Reporter:
            Vesko Karaganev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: