0

I would like to replicate/synchronize a collection named "CollectionA" from a mongoDB "DataBaseA" to a mongoDB "DatabaseB" in real-time

  1. DatabaseB is a normal database (not shared and not a replica)
  2. The DatabaseB will have writes to it, but not for collection "CollectionA"
  3. The synchronization/replication should be done in real-time with a delay defined based on network latency

I'm trying to achieve this without writing any custom code. Is this possible?

1

1 Answer 1

0

Depending on what is your MongoDB server version... Solution is use method "Change Streams" or "Oplog tailing" Where you are "listening" changes of source DB and replicating those commands to destination DB (at other MongoDB installation)

1
  • The Change Streams API is definitely the recommended approach in modern versions of MongoDB (3.6+). Change Streams rely on the replication oplog, but provide a stable API including considerations like durability (only majority-committed changes), security (uses collection-level RBAC), and ordering for change events in a sharded cluster. For some important characteristics of Change Streams, see: An Introduction to Change Streams.
    – Stennie
    Commented Feb 3, 2021 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.