MongoDB
MongoDB is a document store. There is no SQL DDL: migrations are Python scripts that drive pymongo. A .sql file fails with DBLIFT-NOSQL-001 before anything executes.
The assembled URI is mongodb://user:pass@host:port/<database>. The driver reads that path as the default authSource, so credentials are checked against that database. Users defined in the database being migrated work; users defined in admin (a root user created in admin, many Atlas setups) are refused. If your user lives in admin, use the url form and name the auth source. Neither shape is affected when authentication is disabled, which is why this is invisible in a default local container.
database:
type: "mongodb"
url: "mongodb://user:pass@localhost:27017/?authSource=admin"
database: "myapp"Install
pip install "dblift[cli,mongodb]"Connection URL
mongodb://user:password@localhost:27017/appA mongodb:// or mongodb+srv:// URL is accepted as-is. Without a URL, DBLift builds one from host, port, username and password, including /<database> on the path. That path is the driver's default authSource — see the note above. The alias mongo also selects this engine. database is required.
dblift.yaml
database:
type: mongodb
url: "mongodb://db.internal:27017/app"
database: "app"Engine settings
url—A mongodb:// or mongodb+srv:// URI. Atlas TLS, replica-set and auth-source options live here.host / port27017Used when url is omitted. Port defaults to 27017. With username and password, DBLift authenticates against the configured database, not admin.database—Required. The MongoDB database name. In the host form this is also the default authSource.Behaviour notes
Write Python migrations. A .sql file fails with DBLIFT-NOSQL-001. context.execute() of a string raises DBLIFT-NOSQL-002 — MongoDB has no query language for writes.
A migration that fails half-way leaves completed operations in place. Rehearse, and keep each migration small.
Collections are schemaless. database names the MongoDB database.