Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-15540

Drivers require 5.0 cluster to enable $out on secondaries

      $out notes:

      Starting in MongoDB 4.4, $out can run on replica set secondary nodes if all the nodes in cluster have featureCompatibilityVersion set to 4.4 or higher and the Read Preference is set to secondary.

      However Drivers made the decision to only support this feature on 5.0+ clusters. The Server Selection spec says:

      For pre-5.0 servers, an aggregate command is "must-use-primary" if its
      pipeline contains a write stage (e.g. ``$out``, ``$merge``); otherwise, it
      is "may-use-secondary". For 5.0+ servers, secondaries can execute an
      aggregate command with a write stage and all aggregate commands are
      "may-use-secondary". This is discussed in more detail in
      Read preferences and server selection in the CRUD spec.

      DRIVERS-823 / CSHARP-3397 which implements this feature also says:

      As of MongoDB 5.0, drivers can support read preferences (either explicit/per-operation or inherited) for aggregations including an $out/$merge stage. Previously, such pipelines would always require a primary.

      Our documentation should note that $out on secondaries is only available for 5.0+ clusters, not 4.4+ clusters.

            Assignee:
            rea.rustagi@mongodb.com Rea Rustagi
            Reporter:
            james.kovacs@mongodb.com James Kovacs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              41 weeks, 2 days ago