Reputation: 1845
I'm looking for some ways to sync some collections between two MongoDB databases, for instance sync some collections from a local db to a production db. If I use mongodump
and mongorestore
only new documents will be added to the remote DB, the existing ones won't be updated since mongorestore
doesn't perform updates. The alternative would be to delete and recreate the collection every time using the mongodump
output, but I want to avoid (if possible) this approach. So is it possible to synchronize a collection between two MongoDB Databases without having to recreate the collection every time?
Upvotes: 2
Views: 6548
Reputation: 29
I just finished tool diffmongo https://github.com/datacoon/diffmongo that generates list of differences between MongoDb tables and allows to sync collections without drop/restore. But it still could be slower, since it deletes, appends and updates changes for each deleted, added and updated record.
Upvotes: 1
Reputation: 465
there is a mongo-sync config on the config.yml file. There is a similar question here: How to perform one-time DB sync to another DB in MongoDB?
See if this is helpful to you.
Upvotes: 0