A lightweight migration service for Node.js applications using MongoDB, version 0.1.2. It provides automatic migration execution and rollback support with TypeScript types. Key differentiators include simple migration file format (timestamp-name) and automatic tracking via a 'migrations' collection. It requires an existing Mongoose connection and supports sync/rollback operations.
npm install mongo-migration-serviceNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MongoDB, creates a migration service with a migrations folder, runs all pending migrations, and disconnects.
Call Mongoose.connect() before instantiating MongoMigrationService.
Rename migration files to match the required timestamp pattern.
Call rollback() repeatedly to revert multiple batches, or implement custom logic.
Pin to exact version or lock file, and test upgrades.
Use: import MongoMigrationService from 'mongo-migration-service' (default import)
Ensure the directory exists and path is correct (absolute or relative to CWD).
Call Mongoose.connect() before new MongoMigrationService()
Ensure 'type': 'module' in package.json or use .mjs extension, or transpile with TypeScript.