Radoslav Toth
June 23, 2022

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:

  1. Get meta information (list of collections and number of documents in each)
  2. Comparison of actual documents in both, source and destination collections
  3. 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.

Read more

MongoDB NodeShell

Mingo's NodeShell let's you execute JavaScript code to work with data directly in Mingo. This is NOT MONGO SHELL, though. The command must be a regular async JS function with a return value. This allows complex code with loops, conditions and variable initialization to be executed. This code must be a definition of a async function and […]
Radoslav Toth

Mingo’s keyboard shortcuts

We are all tired of new shortcuts we have to learn. Mingo’s shortcuts mimic what you are already used to from a browser or your dev tool. However, Mingo also has some new intuitive “hovering” shortcuts. Just hover over a document and press space or X to select the document. Or hover a document and CMD+C / CTRL+C to copy document value.  To […]
Radoslav Toth

Smart search

The majority of queries we execute on MongoDB collections are very simple. We usually search for an _id, an email or username and we do this many times over every day. To make such searches simple and fast, Mingo provides a few great hacks for you. Value as query First of all, indexed fields can […]
Radoslav Toth

Data relations in Mingo

When documents reference each other, they usually do so by the _id of the referenced document. There are several types of document relations (such as one-to-many, one-to-one, many-to-one, many-to-many), but we can generally say that there is always a parent document (the one referencing) and a child document (the one being referenced). For example, you […]
Radoslav Toth

5 best MongoDB GUI in 2022

What is a MongoDB GUI client? MongoDB GUI is a graphical interface for MongoDB. It provides a way to view and manipulate data in MongoDB databases using the MongoDB API or MongoDB Shell. As you may know, you can query your data through the command line, but this gets messy and you can get easily […]
daviddurika

MongoDB aggregations for beginners

MongoDB's aggregation is one of the most powerful tools in the database, allowing you to perform complex data analysis on large datasets. This article will show you how to use aggregation to create powerful data aggregations. Basic aggregations An aggregation is a powerful tool for data analysis. It allows you to perform complex queries on […]
daviddurika

Download Mingo now

The best MongoDB GUI Admin. Intuitive • Fast • Secure
Try for Free