DBdock can move data between MongoDB and PostgreSQL in either direction. It’s designed for the case where you’ve outgrown MongoDB and want to land on Postgres (or vice versa) — not as a live replication tool.Documentation Index
Fetch the complete documentation index at: https://docs.dbdock.xyz/llms.txt
Use this file to discover all available pages before exploring further.
What gets migrated
Schema
MongoDB collections → Postgres tables (or the reverse). Field types inferred from the source.
Data
Every document/row streamed in configurable batches.
References
Best-effort detection of relationships to set up foreign keys.
Errors
Failed rows are collected in a
_migration_errors table/collection for review.Workflow
Analyze the source
Plan the migration
DBdock generates a schema mapping proposal you can review and customize.See Schema mapping.
Dry run
Run the migration
Keep things in sync (optional)
Directions
MongoDB → PostgreSQL
The most common direction. DBdock:- Flattens nested documents up to a configurable depth (default: 2 levels)
- Stores deeper nesting as
jsonbcolumns - Infers column types from observed values
- Creates indexes for commonly-queried fields
PostgreSQL → MongoDB
Also supported. DBdock:- Maps tables to collections
- Converts rows to documents, preserving column types
- Optionally embeds related rows (one-to-many) into parent documents
- Translates Postgres JSON/JSONB columns to native MongoDB documents
Core principles
- Nothing runs without confirmation. Every migration shows you the plan and waits for you to approve it.
- Errors don’t halt the migration. Failed rows go to
_migration_errorsso you can address them post-hoc without redoing the whole thing. - Idempotent where possible. Re-running a migration with the same config reuses existing tables rather than duplicating.
- You own the schema. The generated mapping is a proposal — save it, edit it, commit it.
See also
dbdock analyze
Understand the source first.
dbdock migrate
The migration command itself.
Schema mapping
How MongoDB types become Postgres types.
Dry runs
Validate without touching production.

