A database migration tool for MongoDB, version 1.3.0, with TypeScript type definitions. It allows you to manage schema and data migrations using change logs, with a focus on simplicity and MongoDB-native operations. Unlike other migration tools, it integrates directly with MongoDB change streams and supports rollback. The package is actively maintained with regular releases, providing a lightweight alternative to heavier frameworks.
npm install mongo-migration-toolNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes the MigrationTool, connects to MongoDB, runs pending migrations, and closes the connection.
Use the promise-based API: `await tool.run()` instead of `tool.run(callback)`.
Run `npx mongo-migration-tool generate <name>` instead.
Provide a string that ends with '/' (e.g., './migrations/') or use `path.join()` to normalize.
Use a distributed lock mechanism (e.g., based on MongoDB atomic findAndModify) before running migrations.
Switch to ESM import: `import { MigrationTool } from 'mongo-migration-tool'`Use `await tool.run()` (promise-based) as callbacks were removed in v2.
Use `db.createCollection('name', { strict: false })` or check existence first.