diff --git a/source/reference/operator/aggregation/merge.txt b/source/reference/operator/aggregation/merge.txt index fd1ca57fd78..984458c9239 100644 --- a/source/reference/operator/aggregation/merge.txt +++ b/source/reference/operator/aggregation/merge.txt @@ -39,10 +39,28 @@ Definition - Can output to a collection in the same or different database. - - Starting in MongoDB 4.4, :pipeline:`$merge` can output to the + - Starting in MongoDB 4.4: + + - :pipeline:`$merge` can output to the same collection that is being aggregated. For more information, see :ref:`merge-behavior-same-collection`. + - Pipelines with the :pipeline:`$merge` stage can run on + replica set secondary nodes if all the nodes in cluster have + :ref:`featureCompatibilityVersion ` set + to ``4.4`` or higher and the :doc:`/core/read-preference` + allows secondary reads. + + - Read operations of the :pipeline:`$merge` statement are sent to + secondary nodes, while the write operations occur only on the + primary node. + + - Not all driver versions support targeting of :pipeline:`$merge` + operations to replica set secondary nodes. Check your + :driver:`driver ` documentation to see when your driver added + support for :pipeline:`$merge` read operations running on + secondary nodes. + - Creates a new collection if the output collection does not already exist. diff --git a/source/reference/operator/aggregation/out.txt b/source/reference/operator/aggregation/out.txt index 873f211c139..bef5df90744 100644 --- a/source/reference/operator/aggregation/out.txt +++ b/source/reference/operator/aggregation/out.txt @@ -151,6 +151,24 @@ Comparison with ``$merge`` Behaviors --------- +$out Read Operations Run on Secondary Replica Set Members +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting in MongoDB 4.4, :pipeline:`$out` can run on +replica set secondary nodes if all the nodes in +cluster have :ref:`featureCompatibilityVersion ` set +to ``4.4`` or higher and the :doc:`/core/read-preference` is set to +secondary. + +Read operations of the :pipeline:`$out` statement occur on the +secondary nodes, while the write operations occur only on the +primary nodes. + +Not all driver versions support targeting of :pipeline:`$out` +operations to replica set secondary nodes. Check your +:driver:`driver ` documentation to see when your driver added +support for :pipeline:`$out` running on a secondary. + Create New Collection ~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/release-notes/4.4.txt b/source/release-notes/4.4.txt index be26ec15797..061291ed008 100644 --- a/source/release-notes/4.4.txt +++ b/source/release-notes/4.4.txt @@ -387,9 +387,19 @@ General Aggregation Improvements ``$out`` ```````` -Starting in MongoDB 4.4, :pipeline:`$out` can output to a collection in -a different database. In earlier versions, :pipeline:`$out` can output -to a collection to the same database where the aggregation is run. +Starting in MongoDB 4.4: + +- :pipeline:`$out` can output to a collection in + a different database. In earlier versions, :pipeline:`$out` can only + output to a collection in the same database database where the + aggregation is run. + +- :pipeline:`$out` can only run on replica set secondary nodes if + all the nodes in cluster have + :ref:`featureCompatibilityVersion ` set to ``4.4`` or + higher and the :doc:`/core/read-preference` allows secondary reads. + Check your :driver:`driver ` documentation to see when your + driver added support. ``$indexStats`` ``````````````` @@ -417,6 +427,20 @@ Starting in MongoDB 4.4 (also available starting in 4.2.4), ``$merge`` `````````` +Starting in MongoDB 4.4: + +- :pipeline:`$merge` can output to a collection in + a different database. In earlier versions, :pipeline:`$merge` can + only output to a collection in the same database where the aggregation + is run. + +- :pipeline:`$merge` can only run on replica set secondary nodes if + all the nodes in cluster have + :ref:`featureCompatibilityVersion ` set to ``4.4`` or + higher and the :doc:`/core/read-preference` allows secondary reads. + Check your :driver:`driver ` documentation to see + when your driver added support. + .. include:: /includes/fact-merge-same-collection-behavior.rst .. include:: /includes/fact-merge-same-collection-warning.rst