Now available: convert MongoDB to PostgreSQL on Layerbase
You can now convert a MongoDB database into PostgreSQL on Layerbase. The source can be an external MongoDB database, Atlas included, or a managed DocumentDB database you already run with us.
The thing to know is that nothing gets copied until you have seen the plan. Layerbase reads the shape of your collections (field names, types and counts, never the document values) and suggests tables and columns. You edit that mapping, decide which references should become foreign keys, and approve it. Then it copies into a new PostgreSQL database and checks the result: row counts, a checksum of the preserved _id values, field coverage, and a sampled round trip back to documents.
Your source database is never changed. Fields you did not map can be kept in a JSONB column instead of being dropped, and each root row keeps its original _id.
What it does not do
It does not rewrite your application. Your MongoDB queries need to become SQL, and indexes, validators, TTL rules and change streams do not carry over. There is also no live replication, so plan a short write freeze for the final copy and re-verify before you switch the connection string.
Who can use it
Conversion is available on paid Layerbase plans once a payment has gone through. Free plans, complimentary plans and active Pro trials cannot start one yet. PostgreSQL is the only target for now; FerretDB as a source and MySQL or MariaDB as targets come later.
Get started
Open the MongoDB to PostgreSQL conversion page, or press Convert on a managed DocumentDB database in your dashboard. For the full walkthrough of mapping review, verification and cutover, read Convert MongoDB to PostgreSQL with a mapping you can review and the conversion docs.
Keep reading
- Convert MongoDB to PostgreSQL with a mapping you can reviewMove MongoDB or DocumentDB into PostgreSQL, edit the table mapping, approve relationships, and inspect verification before switching your application.
- Introducing DocumentDB 1.0: Our 19th Cloud EngineDocumentDB 1.0 joins Layerbase Cloud alongside FerretDB. Run MongoDB-compatible workloads on Free, Solo or Pro, or try it locally on Linux without Docker.
- Northflank alternatives: a preview environment is not a database branchNorthflank gives every pull request its own stack, and the database in that stack starts empty unless you seed it or restore it from a backup you already had. Here is exactly how their forks work, what a copy-on-write branch does differently, what each one costs while a PR sits open, and the cases where Northflank is the right answer.
- Branching with any databaseNeon branches Postgres. PlanetScale branches MySQL. Layerbase branches all of them, because branching happens at the filesystem, not inside the engine. Here is how it works.