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

Enable larger result sets within $facet stage

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Query Execution
    • Fully Compatible

      SERVER-23654 introduced the $facet stage, which combines all outputs of the sub-pipelines into one result document. This is a request to enable some mechanism for returning more than 16MB of results, while still being able to process the same initial result set in multiple ways.

      Original Request

      I have several similar aggregation operations at the same time, for example

      db.cases.aggregate([
         {$match : query},
         {$unwind : "factors"},
      
         //operation 1 of the above result
         // ...
      ])
      
      db.cases.aggregate([
         {$match : query},
         {$unwind : "factors"},
      
         //operation 2 of the above result
         // ...
      ])
      

      The first two stages of aggregation( $match, $unwind ) are the same, and I think it would be a waste to repeat the duplicate stages. So I am asking if there exists a way to forking the pipeline, so that it can share the result from the first two stages, as follows,

      db.cases.aggregation([
         {$match : query},
         {$unwind : "factors"},
         forks : [
            {... operation 1},
            {... operation 2}
         ]
      ])
      

      http://stackoverflow.com/questions/38047527/fork-the-pipeline-of-aggregation

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            profesor79 Greg
            Votes:
            3 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated: