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

Clarify behavior of array traversal in agg expression

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      Consider the following document:

      {b: {[{c: 2}, {c: 3}]}}
      

      If it is referred from an agg expression such as [\{$project: {a: "$b.c"}}]

      then the result (assigned at field "a") will be (unsurprisingly) [2, 3].

      Now consider this document which adds extra array nesting:

      {b: {[[{c: 2}, {c: 3}]]}}
      

      Currently in classic, the expression returns an empty array [], instead of the more arguably rational result of [[2, 3]]

      This bug is about clarifying this behavior and specifically determining if it makes sense to adopt it going forward, particularly in the context of the new optimizer.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            svilen.mihaylov@mongodb.com Svilen Mihaylov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: