-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
0
The documentation states, in different places, that a merge sort occurs on the mongos, or on the Primary database of the collection. The documentation may need to be reconciled, or, if I'm misunderstanding what's being communicated, clarified.
I believe that the mongos is the only shard that merge-sorts the results of a .find() query.
Statements in favor of each:
- the primary shard
- "If the query specifies sorted results using the sort() cursor method, the mongos instance passes the $orderby option to the shards. The primary shard for the database receives and performs a merge sort for all results before returning the data to the client via the mongos."
- the mongos
- "If you call the cursor.sort() method on a query in a sharded environment, the mongod for each shard will sort its results, and the mongos merges each shard’s results before returning them to the client."
I also note that the explanation references the $orderby option, which, according to the documentation, is deprecated as of 3.2.
- documents
-
SERVER-17737 Support distributed merger for aggregation queries
- Open
- related to
-
DOCS-13229 Conflicting info about Aggregation pipelines and sharded collections
- Closed
-
DOCS-8582 Update v3.2, v3.0, and v2.6 versions of sharded-cluster-query-router to specify that merge sort for find operations happen on mongos not on primary shard
- Closed