DB Copy
Copy entire databases or selected collections between clusters in 4 phases: schema (ADD/DROP), indexes, data, per-document resolution. With typed-confirmation, retry of transients, Retry-failed button, and immutable audit envelopes.
What it is
A workspace + engine that runs a multi-phase copy from a source MongoDB cluster to a target. Phase 1 reconciles the namespace list (ADD missing collections, DROP extras with typed confirmation). Phase 2 reconciles indexes (per-index spec match). Phase 3 copies documents (parallel batches with retry). Phase 3b reconciles per-document differences via samplePairs. Each phase emits an audit envelope with plan + result hash.
When to use
Run during dev / staging refresh, cluster migration (e.g. on-prem to Atlas), region migration, or cluster upgrade. The typed-confirmation prevents accidental drops; the audit envelope provides evidence of every change.
How to open
- In the NoSqlStudio desktop app, open the Tools menu → Migrate and Diff → Copy DB, or press Ctrl+Alt+P.
- A wizard opens with source / target picker, namespace selection, and per-phase toggles.
- Pick source + target connections, then pick which databases / collections to copy.
The 4 phases
- Phase 1 (ADD/DROP) — reconcile the namespace list. The wizard shows which collections will be created and which will be dropped on the target. Drops require typed-confirmation (paste the collection name to enable the button).
- Phase 2 (indexes) — reconcile every index with full spec match. Indexes with the same name but different spec are dropped and recreated.
- Phase 3 (data) — copy documents in parallel batches. Transient failures (network blip, connection reset) auto-retry; the engine streams progress including rows / second and ETA.
- Phase 3b (per-document resolution) — for collections where a per-row diff matters, the engine samples N matching keys and shows per-document diffs in a side-by-side viewer. You can accept, override, or skip each.
- Retry-failed — when a phase finishes with failures, the engine surfaces a Retry-failed button that re-runs only the failed items. The Audit Log shows both runs.
Audit
Every phase emits a `copy.finish` / `sync.finish` / `resolve.finish` audit envelope including plan snapshot, result snapshot, and a hash so an external auditor can prove the run was not silently re-played.
Continuous sync (CDC)
The DB Copy CDC sub-flow keeps the target in sync via change streams. After the initial bulk copy, the engine subscribes to oplog / change stream events and applies them to the target with bounded lag. The Schema Diff workspace plugs into the same pipeline to emit a per-collection migration script.
Limitations (v1)
- Phase 3b sample-based resolution is best-effort. For ironclad per-row consistency on huge collections, follow up with a server-side check.
- CDC requires both clusters to expose change streams — works on replica sets and sharded clusters; standalone mongod is unsupported.
- Phase 1 drops are irreversible. The typed-confirmation is your only safety net — read the dialog carefully before pasting.