Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13229

Conflicting info about Aggregation pipelines and sharded collections

      Description

       
      The docs for "Aggregation Pipeline and Sharded Collections" at https://docs.mongodb.com/manual/core/aggregation-pipeline-sharded-collections/ has a behavior section that says "For aggregation operations that must run on multiple shards, if the operations do not require running on the database’s primary shard, these operations will route the results to a random shard to merge the results to avoid overloading the primary shard for that database. The $out stage and the $lookup stage require running on the database’s primary shard."  (starting 3.2)

       

      But the docs for mongos https://docs.mongodb.com/manual/core/sharded-cluster-query-router/#routing-and-results-process say "Changed in version 3.6: For aggregation operations that run on multiple shards, if the operations do not require running on the database’s primary shard, these operations may route the results back to the mongos where the results are then merged."

       

      I asked in slack and Asya confirmed that the latter is the appropriate version - with the clarification that "may" is:

      If the operations do not require running on the database’s primary shard, and need to be merged on a shard, they are merged on a random shard which may include the primary. 

      If the operations do not require running on the database’s primary shard, and DO NOT need to be merged on a shard, they are merged on the mongos.

       

       

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            andrew.feierabend@mongodb.com Andrew Feierabend (Inactive)
            Reporter:
            sheeri.cabral Sheeri Cabral (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              3 years, 8 weeks, 2 days ago