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

Allow n-ary aggregation expressions to compute their array of arguments dynamically

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Query Optimization
    • Query 2019-06-17

      For example, a user might store the arguments to an n-ary expression like $concatArrays inside a document in the collection:

      db.c.insert({arraysToConcat: [[1, 2, 3], [4, 5, 6]]});
      

      There should be a way to use the the value of the field path expression "$arraysToConcat" as the list of arguments to $concatArrays. Neither the expressions {$concatArrays: "$arraysToConcat"} nor {$concatArrays: ["$arraysToConcat"]} have this meaning. SERVER-31786 has a more detailed discussion of the use case.

      Original description

      The $concatArrays operator does not handle using a multi array field already in the collection.

      The current work around is to use $reduce with $concatArrays.

      See SERVER-31786 for more details.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            devnopt Joel Goldfinger
            Votes:
            5 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: