@ggrossetie/db-migrate-mongodb
v2.0.0
Published
mongodb driver for db-migrate
Maintainers
Readme
@ggrossetie/db-migrate-mongodb
MongoDB driver for db-migrate.
This is a fork of db-migrate/mongodb, rewritten for modern Node.js.
Differences with upstream
| | db-migrate/mongodb v1.5.0 | @ggrossetie/db-migrate-mongodb v2.x | |----------------|--------------------------------------------------------------------|-------------------------------------| | Module system | CommonJS | ESM (with CJS bundle) | | MongoDB driver | ^3.3.3 (direct dependency) | >= 5.1.0 < 8 (peer dependency) | | Promises | bluebird | Native | | Node.js | No requirement | >= 22 | | Tested against | MongoDB 2.x/3.x | MongoDB 6.0, 7.0, 8.0 |
Key changes
- ESM first — the source is an ES module. A CJS bundle (
bundle.cjs) is also shipped for compatibility via theexportsfield inpackage.json. mongodbis a peer dependency — you install the MongoDB driver version you need, instead of being locked to a specific major version.- No bluebird — all methods return native promises (and still accept an optional callback for backward compatibility with db-migrate).
- Removed the internal
_run()abstraction — methods call the MongoDB driver API directly.
Installation
npm install @ggrossetie/db-migrate-mongodb mongodbUsage
Refer to the db-migrate documentation for general usage.
Configure your database.json:
{
"defaultEnv": "dev",
"dev": {
"driver": "@ggrossetie/db-migrate-mongodb",
"database": "my_database",
"url": "mongodb://localhost:27017/my_database"
}
}License
MIT
