Compare and sync entire MongoDB databases
Do you ever need to download the production DB to your localhost for development purposes? Or just sync changes from one DB to another?
This can be done using Mingo’s Compare & Sync tool. You don’t need to write scripts or use the terminal mongodump / mongorestore functions, anymore.
With Mingo’s Compare & Sync tool you can:
- compare collections in two different databases (source and destination, databases may be on the same or on different servers)
- select the collections to compare
- analyze each document and tell if it has been added, removed or updated in source collections
- synchronize the changes into destination collections
The comparison happens in 3 steps:
- Get meta information (list of collections and number of documents in each)
- Comparison of actual documents in both, source and destination collections
- Synchronizing document changes into destination collections (if requested)
Under the hood
Document comparison happens on the corresponding servers directly. The comparison creates a hash for each document and sends them back to Mingo. Mingo compares the hashes and tells you how many docs have been added, removed and updated.
Synchronizing
Once the comparison has been finished, Mingo lets you choose the collections you want to synchronize. Before syncing, you are prompted to choose which documents to sync (added, updated, removed).
Saving comparison setup for future use
Once the source db, destination db and the collections to compare have been selected, you can save this comparison setup and reuse it in the future for faster synchronizing.
* The actual hashing may put high CPU load on the servers in case of large collections, so Mingo skips collections with more than 100k documents.
* Running Compare & Sync requires a local mongo instance.