Migrate MariaDB to MongoDB
Beta — live-tested pathMongoDB has no fixed schema, so there is no column-type table for this direction: each MariaDB row becomes one document. DBShifts copies the rows in parallel batches and checks the result with row counts.
Free tier · no credit card
MariaDB vs MongoDB
MariaDB
the community-driven MySQL fork.
MongoDB
the leading document database.
Relational habits that do not survive the move
MariaDB gives you foreign keys, transactions across tables, and a schema the database enforces. MongoDB gives you none of those by default. Referential integrity becomes the application's responsibility, and any orphan rows in the source migrate silently, because nothing on the target rejects them.
Find the orphans before migrating rather than after. A left join looking for children whose parent is missing takes minutes to run and is impossible to reconstruct once the constraint that would have caught them no longer exists.
Deciding what to embed
The reason to move is usually to read a whole aggregate in one operation: an order with its line items, a post with its comments. That means choosing which tables stop being collections and become arrays inside another document.
The guidance that holds up is to embed what is read together and bounded, and reference what is unbounded or shared. Line items belong inside an order because there are a few dozen at most and they are never read alone. Comments on a popular post do not, because there may be thousands and MongoDB documents have a 16MB limit that an unbounded array will eventually reach.
Doing the faithful copy first and reshaping afterwards keeps a verifiable baseline. Reshaping during the migration means a bug in the modelling and a bug in the transfer are indistinguishable.
Types worth checking before you start
DECIMAL must become Decimal128 rather than a double. MariaDB DECIMAL is exact, a double is not, and prices that were correct for years start disagreeing with invoices by fractions of a unit.
TINYINT(1) is MariaDB's boolean and should become a real boolean; plain TINYINT is an integer and should not. The declared width is the only thing distinguishing them, and it is not always used consistently.
MariaDB SET and ENUM have no MongoDB equivalent. SET is naturally an array of strings and ENUM a plain string, but neither keeps the restriction to a fixed value list unless schema validation is added on the target.
MariaDB → MongoDB conversion notes
Engine-specific rules baked into the conversion and transfer pipeline — verified by live certification of this exact pair.
- MariaDB's JSON columns (LONGTEXT + json_valid CHECK) are detected and mapped to real JSON types on targets that have them.
- Engine-specific CHECK constraints like json_valid() are filtered on targets that don't support them — data still migrates.
- Display-width unsigned types (bigint(20) unsigned) are recognized and widened correctly.
- 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 MariaDB to MongoDB migration production-ready in DBShifts?
MariaDB 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 MariaDB 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
Relational to Non-Relational: Moving SQL Data into a Document Model
Foreign keys, JOINs, transactions and fixed schemas each need a deliberate translation into documents.
Migrating MongoDB to SQL (and Back) Without Losing Your Schema
How relational structure is inferred from collections, and what happens to Decimal128 and nested documents.
How We Live-Certified All 49 Migration Paths
The certification harness behind this page's claims.
Masking PII in Flight: Production Data Without Production Risk
Mask during the migration, not after, so real PII never sits in a lower environment.
Reference
Compared with other tools
Errors you may hit
Ready to move MariaDB to MongoDB?
Set up in under two minutes. Validation and rollback included.
Start Free Migration