From c04bc7bb615d5ab23e17b9e5bca75390a1c4e165 Mon Sep 17 00:00:00 2001 From: ian fogelman Date: Thu, 7 Oct 2021 15:42:44 -0400 Subject: [PATCH 1/2] DOCS-13479 Add note for 5.1 out and merge behavior on RS --- .../reference/operator/aggregation/merge.txt | 20 ++++++++++++- source/reference/operator/aggregation/out.txt | 18 +++++++++++ source/release-notes/4.4.txt | 30 +++++++++++++++++-- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/source/reference/operator/aggregation/merge.txt b/source/reference/operator/aggregation/merge.txt index 743cc3a760b..e074d6c7dbf 100644 --- a/source/reference/operator/aggregation/merge.txt +++ b/source/reference/operator/aggregation/merge.txt @@ -40,10 +40,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`` nodes. + + - 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 109fdca022e..9790a9faa5c 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 19a8fe3d452..326f21b977b 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 From 9b0080411275a998dbcf2969fe23443f616eee39 Mon Sep 17 00:00:00 2001 From: ian fogelman Date: Thu, 7 Oct 2021 15:42:44 -0400 Subject: [PATCH 2/2] DOCS-13479 Add note for 5.1 out and merge behavior on RS --- source/reference/operator/aggregation/merge.txt | 6 +++--- source/reference/operator/aggregation/out.txt | 6 +++--- source/release-notes/4.4.txt | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/reference/operator/aggregation/merge.txt b/source/reference/operator/aggregation/merge.txt index e074d6c7dbf..3246a9b9ad3 100644 --- a/source/reference/operator/aggregation/merge.txt +++ b/source/reference/operator/aggregation/merge.txt @@ -47,14 +47,14 @@ Definition 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 + 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`` nodes. + 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 diff --git a/source/reference/operator/aggregation/out.txt b/source/reference/operator/aggregation/out.txt index 9790a9faa5c..e67e0dbd835 100644 --- a/source/reference/operator/aggregation/out.txt +++ b/source/reference/operator/aggregation/out.txt @@ -155,14 +155,14 @@ $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 +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. +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 diff --git a/source/release-notes/4.4.txt b/source/release-notes/4.4.txt index 326f21b977b..a86650a0b08 100644 --- a/source/release-notes/4.4.txt +++ b/source/release-notes/4.4.txt @@ -394,7 +394,7 @@ Starting in MongoDB 4.4: 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 +- :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. @@ -434,7 +434,7 @@ Starting in MongoDB 4.4: 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 +- :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.