mysql
mongodb

Migrate MySQL to MongoDB

Beta — live-tested path

MongoDB has no fixed schema, so there is no column-type table for this direction: each MySQL row becomes one document. DBShifts copies the rows in parallel batches and checks the result with row counts.

Start MySQL → MongoDB Migration

Free tier · no credit card

MySQL vs MongoDB

mysql

MySQL

the world's most deployed open-source relational database.

mongodb

MongoDB

the leading document database.

A table-per-collection copy is rarely what you want

The straightforward conversion turns each table into a collection and each row into a document, which produces a working MongoDB database that is still shaped like a relational one. Joins that the database used to perform now have to happen in the application or through aggregation pipelines, and the result is usually slower and more complex than the source.

The value of the move comes from embedding: an order and its line items as one document, read in a single operation. That is a modelling decision about your specific data, not something a converter should make for you, so the sensible sequence is a faithful copy first, then reshape deliberately, with the copy kept as a checkable baseline.

Types that change meaning on the way in

MySQL DECIMAL should become Decimal128, not double. A converter that maps DECIMAL to a JavaScript double introduces binary rounding into exact values, and it will not be noticed until totals disagree by fractions of a cent.

TINYINT(1) is MySQL's boolean, and it should become a real boolean rather than the integer 0 or 1, otherwise every query written against MongoDB has to know that 1 means true. Plain TINYINT is a small integer and must not get the same treatment.

DATETIME has no timezone in MySQL, while MongoDB stores dates as UTC milliseconds since the epoch. The conversion has to assume a timezone for naive values, and assuming the wrong one shifts every timestamp by a fixed offset that is very hard to spot after the fact.

What you give up, stated plainly

There are no foreign keys. Referential integrity becomes the application's responsibility, and existing orphan rows migrate silently because nothing rejects them.

Transactions exist across documents in modern MongoDB, but they are not the default programming model and carry different performance characteristics from a relational transaction. Code that relied on multi-statement transactions needs review rather than translation.

There is no schema, so nothing prevents a later write from adding a field with a different type in the same collection. Schema validation rules can be added, and on a migrated database they are worth adding immediately, while you still know exactly what the shape should be.

MySQL → MongoDB conversion notes

Engine-specific rules baked into the conversion and transfer pipeline — verified by live certification of this exact pair.

  • TINYINT(1) is treated as a boolean; plain TINYINT stays numeric — converting both blindly corrupts ratings and counters.
  • UNSIGNED integers are widened on targets without unsigned types, so values above the signed range survive.
  • ENUM and SET columns are converted with their value lists preserved (native enums, CHECK constraints, or arrays depending on the target).
  • TIME columns are durations (-838h..838h) at the driver level — DBShifts converts them per target instead of failing the batch.
  • Zero dates (0000-00-00) are normalized deterministically and reported, never silently dropped.
  • Rows become flat documents; write errors surface loudly instead of being swallowed by duplicate-tolerance settings.
  • Integers beyond BSON's 8-byte range (e.g. Oracle NUMBER) become Decimal128, exact up to its 34 significant digits.
  • Dates are stored as native BSON dates (UTC instants).

Frequently asked questions

Is MySQL to MongoDB migration production-ready in DBShifts?

MySQL to MongoDB is in beta. It runs on real servers in the certification suite, which checks it by row counts; the content checks that certify the SQL pairs do not yet compare documents with rows. Every migration still ends with a fidelity report to audit before cutover.

Can I keep MySQL and MongoDB in sync after the initial migration?

Yes, until you cut over. DBShifts reads the row-based binary log (binlog_format = ROW). With zero-downtime mode on, the log position is captured before the first row is copied, so writes made during the copy are replayed afterwards.

Go deeper

Ready to move MySQL to MongoDB?

Set up in under two minutes. Validation and rollback included.

Start Free Migration