Skip to content

Commit 10cc97b

Browse files
authored
DOCS-13479 Add note for out and merge behavior on RS (#6065)
* DOCS-13479 Add note for 5.1 out and merge behavior on RS * DOCS-13479 Add note for 5.1 out and merge behavior on RS
1 parent 10556e3 commit 10cc97b

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

source/reference/operator/aggregation/merge.txt

+19-1
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,28 @@ Definition
3939

4040
- Can output to a collection in the same or different database.
4141

42-
- Starting in MongoDB 4.4, :pipeline:`$merge` can output to the
42+
- Starting in MongoDB 4.4:
43+
44+
- :pipeline:`$merge` can output to the
4345
same collection that is being aggregated. For more
4446
information, see :ref:`merge-behavior-same-collection`.
4547

48+
- Pipelines with the :pipeline:`$merge` stage can run on
49+
replica set secondary nodes if all the nodes in cluster have
50+
:ref:`featureCompatibilityVersion <view-fcv>` set
51+
to ``4.4`` or higher and the :doc:`/core/read-preference`
52+
allows secondary reads.
53+
54+
- Read operations of the :pipeline:`$merge` statement are sent to
55+
secondary nodes, while the write operations occur only on the
56+
primary node.
57+
58+
- Not all driver versions support targeting of :pipeline:`$merge`
59+
operations to replica set secondary nodes. Check your
60+
:driver:`driver </>` documentation to see when your driver added
61+
support for :pipeline:`$merge` read operations running on
62+
secondary nodes.
63+
4664
- Creates a new collection if the output collection does not already
4765
exist.
4866

source/reference/operator/aggregation/out.txt

+18
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@ Comparison with ``$merge``
151151
Behaviors
152152
---------
153153

154+
$out Read Operations Run on Secondary Replica Set Members
155+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156+
157+
Starting in MongoDB 4.4, :pipeline:`$out` can run on
158+
replica set secondary nodes if all the nodes in
159+
cluster have :ref:`featureCompatibilityVersion <view-fcv>` set
160+
to ``4.4`` or higher and the :doc:`/core/read-preference` is set to
161+
secondary.
162+
163+
Read operations of the :pipeline:`$out` statement occur on the
164+
secondary nodes, while the write operations occur only on the
165+
primary nodes.
166+
167+
Not all driver versions support targeting of :pipeline:`$out`
168+
operations to replica set secondary nodes. Check your
169+
:driver:`driver </>` documentation to see when your driver added
170+
support for :pipeline:`$out` running on a secondary.
171+
154172
Create New Collection
155173
~~~~~~~~~~~~~~~~~~~~~
156174

source/release-notes/4.4.txt

+27-3
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,19 @@ General Aggregation Improvements
387387
``$out``
388388
````````
389389

390-
Starting in MongoDB 4.4, :pipeline:`$out` can output to a collection in
391-
a different database. In earlier versions, :pipeline:`$out` can output
392-
to a collection to the same database where the aggregation is run.
390+
Starting in MongoDB 4.4:
391+
392+
- :pipeline:`$out` can output to a collection in
393+
a different database. In earlier versions, :pipeline:`$out` can only
394+
output to a collection in the same database database where the
395+
aggregation is run.
396+
397+
- :pipeline:`$out` can only run on replica set secondary nodes if
398+
all the nodes in cluster have
399+
:ref:`featureCompatibilityVersion <view-fcv>` set to ``4.4`` or
400+
higher and the :doc:`/core/read-preference` allows secondary reads.
401+
Check your :driver:`driver </>` documentation to see when your
402+
driver added support.
393403

394404
``$indexStats``
395405
```````````````
@@ -417,6 +427,20 @@ Starting in MongoDB 4.4 (also available starting in 4.2.4),
417427
``$merge``
418428
``````````
419429

430+
Starting in MongoDB 4.4:
431+
432+
- :pipeline:`$merge` can output to a collection in
433+
a different database. In earlier versions, :pipeline:`$merge` can
434+
only output to a collection in the same database where the aggregation
435+
is run.
436+
437+
- :pipeline:`$merge` can only run on replica set secondary nodes if
438+
all the nodes in cluster have
439+
:ref:`featureCompatibilityVersion <view-fcv>` set to ``4.4`` or
440+
higher and the :doc:`/core/read-preference` allows secondary reads.
441+
Check your :driver:`driver </>` documentation to see
442+
when your driver added support.
443+
420444
.. include:: /includes/fact-merge-same-collection-behavior.rst
421445

422446
.. include:: /includes/fact-merge-same-collection-warning.rst

0 commit comments

Comments
 (0)