Documentation
Schema Diff
Side-by-side schema shape comparator that emits an idempotent mongosh migration script. Useful as a PR gate or before a major refactor.
What it is
A workspace tab that compares two schema shapes (paste JSON or sample from a live connection) and renders the differences in a side-by-side panel. The Migration tab emits a mongosh script you can run on the target to make it match — safe to re-run because every step is idempotent.
When to use
Wire as a PR gate so a teammate cannot land a schema change without a generated migration plan. Run before a major refactor to see exactly what fields and types differ between branches. Run after a refresh to confirm dev / staging matches production.
How to open
- In the NoSqlStudio desktop app, open the Tools menu → Schema Diff, or press Ctrl+Alt+Shift+D.
- The workspace opens with two paste areas (Source and Target) at the top, a diff panel in the middle, and the Migration tab at the bottom.
- Paste two schema shapes (sample documents work too — the engine infers the shape) and click Compare.
Workflow
- Source — paste the desired schema shape (typically the production sample or the target after refactor).
- Target — paste the current shape on the receiving cluster (dev or staging).
- Diff — the engine renders added fields (green), removed fields (red), and type changes (yellow). Click any row to see the actual field path and inferred BSON type.
- Migration — switch to the Migration tab. The engine emits a mongosh script using $set/$unset/$rename + collMod for index changes. The script is idempotent — running it on an already-converged target is a no-op.
- Copy or download the script. Run it from mongosh on the target, then re-run Compare to confirm the diff is empty.
Limitations (v1)
- Inference is sample-based. If your schema has rare branches that did not appear in the sample, the engine misses them — set sample size to cover representative documents.
- Migration script handles fields and indexes; it does not handle views, search indexes, or time-series collections. Wire those separately.
- No transactional guarantee — the generated script runs each step independently. For multi-document consistency you must wrap it yourself in a session.startTransaction block.