Does MongoDB supports data replication in bidirectional way. We are using community edition (3.6 version) in Windows server operating system. I have also checked replication process but it was not mentioned related to bidirectional. Thank you.
Welcome to the MongoDB Community @naresh_reddy!
The core replication feature in MongoDB server is based around changes replicating from a primary server to other data-bearing secondary members of the same replica set. See Replication in the MongoDB server documentation for more detail.
You cannot have multiple primaries in a single replica set. You could potentially build your own solution for replicating changes (and resolving associated conflicts) using MongoDB Change Streams. I recommend upgrading to MongoDB 4.0 or newer if you are planning on using Change Streams, as there are expanded streaming options including ability to watch a single database or all non-system collections in a deployment. Another good reason to upgrade: MongoDB 3.6 will reach end of life next month (April, 2021) per the MongoDB Support Policy.
If you are open to using MongoDB Atlas, another approach to consider would be bidirectional sync and automatic conflict resolution using Realm Sync. Realm Sync is designed for offline-first use cases where changes can be written locally on client devices and synced with a MongoDB Atlas deployment.
Thank you for quick suggestion and we will look into mentioned approach
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.