Skip to content

Migrate into MongoDB

Tested with: MongoDB (Percona Server) 8.0 on Databasezy · zb CLI 0.1

Sources: MongoDB Atlas, Railway, DigitalOcean, self-hosted MongoDB or FerretDB, Docker containers, mongodump archives (.bson.tar), another Databasezy instance.

mongodump --archive | mongorestore --archive, streamed with no intermediate file. --include maps to --nsInclude, and a different target database name is mapped with --nsFrom/--nsTo. Uploaded .bson.tar files are unpacked and restored with mongorestore --dir.

FerretDB and MongoDB speak the same wire protocol, so MongoDB to FerretDB and FerretDB to MongoDB use the same path; FerretDB reports index options it does not support.

shell
# --dry-run prints the preflight checklist and the exact plan without changing anything
zb migrate --from "mongodb+srv://migrator:[email protected]/app" --engine mongodb --to inst_abc
zb migrate --from ./app.bson.tar --engine mongodb --to inst_abc
zb migrate --from local --engine mongodb --db app --to inst_abc # mongodump --archive locally

Follow it with zb migrate status <mig_id>, or in the portal under the instance’s Migrate in tab.

Document count per collection and the total index count. Mismatches are listed in the result; nothing is switched for you.

  • Copy only; change-stream sync is not offered.
  • Atlas Search indexes, triggers and Data API settings are Atlas features and are not copied.
  • Users and roles are not copied.

How migrations work covers preflight, verification and cutover; engine conversions covers moves between engines.