A database migration tool for MongoDB in Node.js. Current stable version is 2.2.7. It provides a simple CLI to initialize, create, run up/down migrations, and check status. Key differentiators: lightweight, uses the official MongoDB Node.js driver, supports both callback and Promise API, and stores changelog in a MongoDB collection. Releases are infrequent but stable. Ideal for projects needing a straightforward migration solution without complex setup.
npm install codemao-migrate-mongoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to initialize a project, create a migration file, write up/down functions, and run migrations using async/await.
Ensure each migration module exports both up and down functions, even if down is a no-op.
Use db.collection() directly. Do not call db.close() or use MongoClient inside migrations.
Use async functions: module.exports.up = async (db) => { ... }Keep the changelogCollectionName consistent across all environments.
Run 'npm install -g migrate-mongo' or 'npm install --save-dev migrate-mongo' and use npx.
Start MongoDB service or update config.js with correct connection URL.
Either use CommonJS (module.exports) or set 'type':'module' in package.json and use import/export syntax accordingly.
Ensure migration function accepts exactly one argument (db) for async style or two (db, next) for callback style.