An abstract migration framework for Node.js that stores migration state either in a local file or in a MongoDB collection (useful for multi-instance environments). Version 0.8.2 is the latest stable release. The package is a fork of ikatun/node-migrate, which itself was forked from tj/node-migrate. It uses native MongoDB promises. Key differentiators include support for state persistence in MongoDB, seamless switching from file-based state (e.g., tj/node-migrate) to MongoDB, and CLI commands for up, down, rollback, and create migrations. Compared to alternatives like `migrate-mongo` or `db-migrate`, this package is lightweight and focused solely on MongoDB state storage.
npm install node-mongodb-migrationsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows installation, creating a simple migration file, and programmatic usage with require() and migrate.load().
Use callbacks or wrap in a Promise manually. For example: const up = () => new Promise((resolve, reject) => { exports.up = function(next) { resolve(next()); }; });Consider migrating to actively maintained alternatives like migrate-mongo or db-migrate.
Ensure either state file or MongoDB is used exclusively, or verify the migration state manually.
Update code to use native MongoDB driver API if you were using then-mongo features.
Run `npm install node-mongodb-migrations` in your project directory.
Use `const migrate = require('node-mongodb-migrations');` instead of `import migrate from ...`Set the environment variable to a valid MongoDB URI with proper authentication, e.g., mongodb://user:pass@host:port/db
Ensure exports.up and exports.down have a `next` parameter and call it when done: exports.up = function(next) { ... next(); }