MongoDB: limits and operations
This page is for database administrators who decide whether MongoDB fits a site, or who already run one. It answers: what the adapter does not support, how to recognize a feature that silently returns nothing, how upgrades and schema checks work without SQL, how to back up, and how a MySQL site is moved to MongoDB. Sources: MongoDB as the database, 9.5 MongoDB and section 26 of the porting reference.
Contents
- How the adapter works
- Known limits
- Finding untranslated SQL
- Upgrades without SQL files
- Backups
- Moving a MySQL site to MongoDB
- Performance
- Checklist
How the adapter works
expMongoDB never runs real SQL. It parses the kernel's SQL-shaped calls and turns them into find, aggregate,
insert, upsert and delete operations on collections named like the kernel's tables (ezcontentobject,
ezcontentobject_tree and so on). Its schema handler is expMongoSchema (settings/dbschema.ini, type mongo).
eZDB::instance()->databaseName() returns mongo.
Known limits
Since Exponential 6.0.15 a SELECT the adapter cannot turn into MongoDB operations (joins, GROUP BY with HAVING,
UNION, derived tables, sub-selects) is answered by the SQL fallback: the collections the statement names are
copied into an in-memory SQLite database, typed by the .dba schema, and the statement runs there, so it returns
what MySQL, PostgreSQL and SQLite return. The copy is kept until the next write through the adapter or for two
seconds. Settings in site.ini [DatabaseSettings]:
| Setting | Default | What it does |
|---|---|---|
MongoSQLFallback | enabled | disabled restores the behavior of 6.0.14: an empty result and a MONGO TODO warning |
MongoSQLFallbackMaxRows | 200000 | a collection with more documents is not copied; the statement is refused as before |
MongoSQLFallbackLifetime | 2 | seconds a copy keeps answering when no write came in between |
The fallback needs PHP's sqlite3 extension (bundled with PHP). It costs a read of every document of the
collections involved, so the kernel's frequent paths keep their own MongoDB pipelines; the fallback serves the
admin views, reports, cronjobs and extensions that send SQL of their own.
What remains:
- A SELECT over a collection larger than
MongoSQLFallbackMaxRows, and a write that needs SQL (anUPDATEorDELETEwith a join or a sub-select the adapter cannot read), are refused and logged. An empty result is not an answer: code that decides access with its own SQL must read it as "no", never as "nothing restricts this". - The SQL query cache does not apply.
- There are no SQL update files.
- Errors:
errorNumber()reports MongoDB's codes (11000for a duplicate key); the driver answersfalseand throws nothing (Database error codes and messages).
Measured on 18 November 2026 with the same site package installed on SQLite, MongoDB and Oracle: the front end and
the admin pages, content creation, publishing, moving with URL aliases, roles, tags, search, the cronjob parts and
the trash give the same results on MongoDB as on SQLite; the details are in
Database support. Earlier limits of this page (deep URL alias
regeneration after a move, empty role and policy lists, cronjobs, eztags) no longer apply.
Test every extension and every workflow your site uses on a staging copy before you go live.
Finding untranslated SQL
Search the logs for the marker the adapter writes:
grep -rn "MONGO TODO" var/log/ | tail -20
grep -rn "sqlFallback\|refused" var/log/error.log | tail -20A MONGO TODO warning appears only with MongoSQLFallback=disabled; with the fallback on, a statement it could not
answer is logged as an error that starts with expMongoDB::sqlFallback (too many documents, or SQL that SQLite
does not accept). Each hit names a statement that returned an empty result instead of data. A page that shows "nothing found" where
other engines show content usually has a hit here. Report kernel statements on the
software tracker; fix your own extensions' SQL
(Reviewing extension SQL for every engine).
Upgrades without SQL files
MongoDB has no update/database/ directory. What replaces it:
- Setup > Upgrade check, "Check database consistency", compares collections instead of tables: missing
collections grouped by feature, collections not in the schema, and the
mongoshcommands that create the missing ones (The upgrade check). php update/common/scripts/6.0/createaudittables.phpcreates the audit index collections of 6.0.15 through the schema handler (--dry-runfirst).- The trash documents get
trashed_byandtrashed_viawhen written; older ones read as their defaults, somovetrashrecords.phpruns as on the other engines. - Run
bin/mongodb/create_indexes.jsagain after an upgrade.
Backups
mongodump --uri="mongodb://exponential@localhost:27017/exponential" --out=/backup/$(date +%F)
mongorestore --uri="mongodb://exponential@localhost:27017/exponential" --drop /backup/2026-10-05The tools ask for the password when the URI has none. Replica sets, oplog-based point-in-time backups and snapshots
are MongoDB's own features and work as with any client. Back up var/storage and settings/override with the
database (Backups per engine).
Moving a MySQL site to MongoDB
The scripts in bin/mongodb/ move an existing MySQL site:
| Script | Role |
|---|---|
export_mysql.sh | dumps every Exponential table from MySQL to NDJSON (the password comes from MYSQL_PASSWORD) |
mysql2ndjson.py | the converter export_mysql.sh calls |
fixup_ndjson.py | post-processes the files: integer _ids, NULL strings dropped, known integer fields cast |
validate_ndjson.sh | checks that each file is valid JSON, one object per line; exit 1 on errors |
import_all.sh | imports the files into MongoDB in dependency order |
The procedure is section 18 of the porting reference. Plan a maintenance window, then create the indexes and run the cronjobs (Moving a site to another engine).
Performance
Performance follows the number of statements per page, because each kernel call becomes one or more MongoDB
operations. The indexes from create_indexes.js are the first lever; the caches in front of the database are the
second (Performance and scaling).
Checklist
- To do: Every extension and workflow tested on staging; no
MONGO TODOin the logs after a full click-through. - To do:
eztags, shop checkout andezflownot needed, or tested. - To do: Indexes created after install and after each upgrade.
- To do: Upgrade check run after each upgrade; missing collections created.
- To do:
mongodumpbackups scheduled and a restore tested.
Related pages
- Setting up MongoDB
- Choosing an engine
- MongoDB for hosts
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.