Migrate MongoDB to MySQL — Collections into Tables

One-click data migration tool for MongoDB to PostgreSQL. GUI & CLI supported, cross-platform, 100% local & secure.

All MongoDB Deployments Windows / Linux / macOS GUI + CLI Modes 4 Mapping Modes Scheduled Sync

What you can do with MongoToDB

A MongoDB database has no schema, so the work is deciding what each collection becomes: one table, many tables, or one table fed by many collections. Eight operations, one dialog.

MySQL carries one advantage here: a JSON column. A nested document or an array can be written as JSON and still be queried with JSON_EXTRACT, so the shape survives the migration instead of being flattened into text.

Whole database

Migrate a whole database

Every collection becomes a table in one run.

  • Database and collection names map to schema and table names
  • Start here when the MySQL schema does not exist yet
View screenshot
One collection

Collection to table

One collection in, one MySQL table out.

  • Nested documents and arrays land in a nvarchar(max) column
  • The target table is created from the sampled shape
View screenshot
One collection

Query to table

Filter on the MongoDB side, then insert.

  • Any find() filter β€” or an aggregation β€” defines the rows
  • Only the returned documents are written
View screenshot
Many collections

Merge collections to one table

Collections that share a shape add up to one table.

  • One collection per day or per tenant is the usual case
  • Columns are taken from the first document, the rest are nullable
View screenshot
Many collections

Batch collections to tables

Many collections, one pass.

  • Map each collection to its own table
  • Replace or append is chosen per collection
View screenshot
Both sides

Map BSON types to MySQL

Field by field, decided once.

  • ObjectId → text, Date → timestamptz
  • Nested documents and arrays → jsonb; Decimal128 → numeric
View screenshot
Both sides

Keep MySQL current

Re-run the session instead of re-importing.

  • Full sync replaces the contents
  • Incremental sync upserts on the key you name (_id is the usual one)
View screenshot
Automation

Schedule the job

Run it on a timer.

  • Save the session as .bat or .sh
  • Task Scheduler on Windows, Crontab on Linux, launchd on macOS
View screenshot

How to Migrate MongoDB to PostgreSQL in 4 Simple Steps

  1. Connect MongoDB and PostgreSQL: Enter MongoDB URI or config, test connection in one click πŸ“·. Input PostgreSQL host, port, account and target database πŸ“·.
  2. Select Migration Mode: Choose query, single collection or multiple collections. πŸ“·
  3. Configure Field Mapping & Preview: Auto-load fields, customize types and rules πŸ“·. Check sample data before real migration πŸ“·.
  4. Start & Verify: Monitor progress πŸ“· and view result directly πŸ“·.

MongoDB — MySQL Type Mapping

MongoDB (BSON)MySQL
StringVARCHAR(255) / LONGTEXT
ObjectIdCHAR(24) or VARCHAR(36)
Int32 / Int64INT / BIGINT
DoubleDOUBLE
Decimal128DECIMAL(38,10)
BooleanTINYINT(1)
DateDATETIME(3)
Nested documentJSON (MySQL 5.7+)
ArrayJSON
BinDataLONGBLOB

Common Pitfalls When Moving MongoDB into MySQL

  • No schema means the table is guessed: the tool samples documents, so a field that appears later becomes a column only on the next run.
  • ObjectId is 12 bytes of BSON; as CHAR(24) it keeps lexicographic order, as VARCHAR(36) it does not β€” pick per what the app joins on.
  • Mixed types in one field arrive as text or JSON: MongoDB allows a string and a number in the same field, a MySQL column does not.
  • A MongoDB document can exceed LONGTEXT/LONGBLOB comfort (16 MB in practice for MySQL's max_allowed_packet), so check the largest document first.
  • Indexes, validators and _id uniqueness are not carried over as constraints: the rows arrive, the rules do not.

CLI Mode for Automation & Scheduled Sync

Prerequisite

Save your migration session in GUI first (config auto-generated).

Run via Command Line
  • Windows: Launch executable with saved session file
  • Linux / macOS: Run script in terminal with session path
Schedule Auto Sync
  • Windows: Use Task Scheduler with .bat file
  • Linux/macOS: Use Crontab with .sh script

Frequently Asked Questions

Which MongoDB versions are supported?

Supports MongoDB 4.2 ~ 8.0+.

Which PostgreSQL versions are supported?

Supports PostgreSQL 9.x, 10, 11, 12, 13, 14, 15, 16, 17, 18.

What’s the limit of free trial?

Free trial supports up to 1000 rows. All features are fully unlocked.

How to fix connection failure to MongoDB Atlas?

Check network, port, URI, account and whitelist settings.

Can I sync data automatically?

Yes. Use CLI + scheduled tasks to achieve real-time sync.

How to handle incompatible data types?

Auto-adapt most types. ObjectId can be mapped to VARCHAR manually.

Start Your MongoDB to PostgreSQL Migration Today

Fast, secure, easy-to-use, cross-platform. No technical skills required.

Free Download Now