File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,16 @@ to be done on the primary shard.
30
30
.. versionchanged:: 3.6
31
31
32
32
When aggregation operations run on multiple shards, the results are
33
- routed to the :binary:`~bin.mongos` to be merged. However, :pipeline:`$out`
34
- and :pipeline:`$lookup` must run on the :ref:`primary shard <primary-shard>`
35
- and are aggregated there.
33
+ routed to the :binary:`~bin.mongos` to be merged, except in the
34
+ following cases:
35
+
36
+ - If the pipeline includes the :pipeline:`$out` or
37
+ :pipeline:`$lookup` stages, the merge runs on the
38
+ :ref:`primary shard <primary-shard>`.
39
+
40
+ - If the pipeline includes a sorting or grouping stage, and the
41
+ :ref:`allowDiskUse <aggregate-cmd-allowDiskUse>` setting is enabled,
42
+ the merge runs on a randomly-selected shard.
36
43
37
44
Optimization
38
45
------------
Original file line number Diff line number Diff line change @@ -98,7 +98,9 @@ arguments:
98
98
99
99
100
100
101
- * - ``allowDiskUse``
101
+ * - .. _aggregate-cmd-allowDiskUse:
102
+
103
+ ``allowDiskUse``
102
104
103
105
- boolean
104
106
You can’t perform that action at this time.
0 commit comments