Does Changing the Node in My MongoDB Connection String Trigger a Historical Re-Sync?
Question
If I change the node in the connection string for my MongoDB connection to a different node within the same cluster, will that require or cause a historical re-sync of my data?
Environment
Connector: MongoDB
Answer
No, updating the specified node in your connection string won't trigger a historical re-sync. All nodes at the cluster level share the same Oplogs, which make up the change streams.
For MongoDB connections, we use a deployment-level change stream and read it using a resumeToken
stored in the connection's state. The token remains valid across nodes, so updating the specified node doesn't trigger a historical re-sync.
If you don't specify a node in the connection string, MongoDB automatically determines which node the connection will use. Similarly, if you update from a specified node to readPreference=secondary
, MongoDB routes the request to a secondary node without affecting the access to Oplogs or the change streams.