Skip to main content
Cross-database migration requires a type system translation. This page documents exactly how DBDock maps types in both directions.

MongoDB → PostgreSQL

Scalar types

Container types

Mixed types

If a field has multiple types across documents (e.g., 99% Int, 1% Double), DBDock picks the “widest” compatible Postgres type. You’ll see a warning:
You can override this by editing the exported config file.

Example

MongoDB:
Postgres (with --max-depth 2):

PostgreSQL → MongoDB

Scalar types

Container types

Relationships

DBDock can optionally embed one-to-many relationships into parent documents:
  • Reference mode (default): stores the FK as-is, creates separate collections.
  • Embed mode: pulls child rows into a nested array on the parent document.
Configure per-table in the exported config file.

Example

Postgres:
MongoDB (reference mode):
MongoDB (embed mode):

Customizing the mapping

Export the generated plan:
Edit the file — change column types, rename fields, flag embeds, skip collections. Then run with the custom config:
Commit the config file to git so your team uses the same mapping.