Data Compare & Sync
Data Compare (labelled Data Compare in the app) shows you exactly how two collections differ — across databases, connections or environments such as production and staging. You lay out what to compare on a canvas, run every pair at once, then review document-by-document and field-by-field differences and sync the ones you choose. It works for MongoDB collections and for SQL tables.
Get started with a comparison in VisuaLeaf:
A comparison is set up on a canvas. Sources sit in the left column, targets in the right column, and every pair you create is drawn as a line between them. The Comparison panel on the right lists each pair with its match key and whether it has run yet.
Click New comparison in the Data Compare list to open an empty canvas. It offers two ways to start: Match whole database, or Add source / Add target to place collections yourself. Use the zoom controls in the bottom-left corner when the canvas gets busy.
The fastest way to compare two copies of the same database. Click Match whole database, then choose the Source database and Target database — each one is a connection and database, so the two can live on different servers.
A MongoDB database can only be matched with another MongoDB database, and a SQL database with another SQL database.
To compare collections whose names differ, or just a few of them, build the pairs yourself:
A source can be paired with several targets. Clicking two database cards pairs all of their same-named collections at once. Hover a card and click its × to remove it from the canvas along with its pairs.
Each line carries a label showing the match key and an estimate of how many documents will be compared. A label shown in red means the pair has no match key yet.
Click a pair's label to open its settings in the side panel. The panel shows the source and target, the estimated document count and how long the comparison should take, plus:
_id is the default; click + Add key to match on business keys such as email or customerNumber{"status": "active"}) or to include or exclude fields from the comparisonAfter a run, the panel also shows the pair's last result with an Open full results button.
A comparison runs fine without a name, but naming it lets you come back to it:
Click Run comparison to run every pair at once. If a connection a pair needs is not open, VisuaLeaf offers to connect it first.
The Results step shows one pair at a time; switch pairs from the selector at the top. The Summary tab gives the totals, when the run started and finished, how long it took, whether the result files are encrypted, and the match keys and filters used.
In the example above, production verdant_market.customers was compared against verdant_market_staging.customers: 37 customers differ, 12 exist only in production, and 2 exist only in staging.
| Tab | Description |
|---|---|
Summary |
Totals, run timing and status, and the configuration used |
All |
Every compared document in one list |
Modified |
Documents that exist on both sides but have different field values |
Missing in source |
Documents present in the target but not in the source |
Missing in target |
Documents present in the source but not in the target |
Log |
History of sync operations performed on this comparison |
Each list tab shows a paged table with a toolbar for Select all, Clear and Refresh, and the sync controls on the right. Its columns are:
The Missing in target and Missing in source tabs list the documents that exist on only one side, with a field count and a preview of the document that does exist.
Click a modified document's row to expand it. Every field is listed by its path (e.g. addresses.0.city, preferences.language) with its value on each side. Unchanged fields are marked Identical; the fields that differ stand out with a Modified badge.
Here the only difference is segment: the customer is "loyal" in production and "vip" in staging.
Each document is classified into one of four buckets so you can filter results and sync exactly what you need:
| Bucket | Meaning |
|---|---|
| Identical | Match keys align and every compared field is equal on both sides |
| Modified | Match keys align but one or more fields differ — expand the row to see which |
| Missing in target | The document (or row) exists in the source but not in the target |
| Missing in source | The document (or row) exists in the target but not in the source |
Nested fields and array elements are compared individually and shown with dot notation, so a change deep inside a document is pinpointed rather than flagged on the whole object.
Data Compare also works on SQL tables — for example a PostgreSQL customers table in production against the same table in staging. SQL tables pair with SQL tables, and MongoDB collections with MongoDB collections.
Open Connection Manager and add the SQL connections you want to compare, for example production and staging PostgreSQL.
Click the pair's label, then Pair settings…. Pick the target table, then mark the columns that identify a row (the primary key is a good choice) and any columns to ignore. A SQL pair cannot run until at least one matching column is chosen. You can also choose how the tables are compared:
Click Run comparison. Progress appears on the pair's line just as it does for collections.
Open the Modified tab to see which columns drifted in which rows. Select the rows to fix, set the direction, choose whether to write All columns or only Changed columns, and click Quick sync. Then re-compare to confirm the tables now match.
After reviewing the results, you can bring selected documents into line between the two sides.
The Source → Target toggle in the results toolbar sets which side is written to; click it to swap. The same result can sync either way without re-running the comparison.
For modified documents, choose how they are written: Replace the whole document, or Update ($set) only the changed fields. When fields are excluded from the comparison, $unset options are offered as well.
Comparisons and syncs both report progress as they go:
There are two ways to sync: Quick sync writes immediately, while Sync plan shows you exactly what will be written first. For MongoDB collections:
| Operation Type | Description |
|---|---|
Insert |
The document is added to the side being written (for missing documents) |
Replace / Update |
The existing document is replaced, or only its changed fields are updated (for modified documents) |
Delete |
The document is removed from the side being written |
The Log tab records every sync run against this comparison — the operation, whether it succeeded, where it was written, the document it touched, when it happened and any error message. Until you run a sync it reads “No sync operations performed yet”.
Click a source or target value in the results table to open documents:
Comparison results are stored locally and can be encrypted. Click the storage path in the results header to open settings and change the results directory.
Run the comparison again with the same configuration from the results header, or click Run this pair on the canvas. This is the quickest way to confirm a sync did what you expected.
Environment Synchronization
Match a production database against staging in one step to see every collection that has drifted, then push or pull the differences.
Data Migration Validation
After migrating data, compare source and destination to verify completeness. Check for missing or modified documents.
Backup Verification
Compare a collection against its backup to ensure data integrity and identify any discrepancies.
Multi-Region Consistency
Compare collections across different MongoDB instances or regions to ensure data consistency.
_id or business keys (email, orderId) so documents are matched correctly.Download and start managing your MongoDB and SQL databases with ease.
Download Free Trial