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

Aggregation pipeline project expression operator to concatenate multiple arrays into one


    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.5
    • Component/s: Aggregation Framework
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Quint Iteration 4, Quint Iteration 5


      I need to count the number of duplicate IDs that occur across all documents in a collection. However, this very simple aggregation is complicated by the fact that the IDs in question may appear in multiple fields in the input document.

      Suppose I have input documents like the one below:

        a : [1, 2, 3],
        b : [2, 4, 5]

      I'd like to transform this to a document that looks like:

        c : [1, 2, 3, 2, 4, 5]

      From this point, it is straightforward to unwind and group on c to get to the desired result.

      The above transformation is similar to what would be achieved using the $setUnion operator, but here I do not want to filter out duplicate values.

      Therefore, this request is for an operator similar to $setUnion but which does not filter out duplicate values.


          Issue Links



              • Votes:
                1 Vote for this issue
                8 Start watching this issue


                • Created: