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

Allow collection-agnostic aggregation within $unionWith

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

      Collection-agnostic aggregations that get their documents from a document-generating stage like $documents are sent to the server with aggregate: 1. There is currently no way to do this for a pipeline within a $unionWith stage, which will fail with a parse error if the specified collection is 1.

      BSON field '$unionWith.coll' is the wrong type 'int', expected type 'string'

      This ticket should enable pipelines like:

      {
          aggregate: 1,
              pipeline:
                  [
                      {$documents: [{a: 1}]},
                      {
                          $unionWith: {
                              coll: 1,
                              pipeline: [
                                  {$documents: [{a: 2}]},
                              ]
                          }
                      },
                  ],
              cursor: {}
      }
      

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            davis.haupt@mongodb.com Davis Haupt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: