Does golang support targeting of mongoDB $merge operations to replica set secondary nodes?

I have a query regarding below points in mongodb documentation. Can someone please elaborate these below points and let me know if golang support targeting of $merge operations to replica set secondary nodes ?
https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#mongodb-pipeline-pipe.-merge

  • Read operations of the $merge statement are sent to secondary nodes, while the write operations occur only on the primary node.

  • Not all driver versions support targeting of $merge operations to replica set secondary nodes. Check your driver documentation to see when your driver added support for $merge read operations running on secondary nodes.

The idea is that despite the fact that most of write operations can happen only on primary, the $out and $merge operations, as exception, can happen on secondaries as well.

Not all driver versions support targeting of $merge operations to replica set secondary nodes.

I think latest go driver should support it (most-likely it supports it few years, but not sure about exact date).

Leave a Comment