Yammy is a MongoDB migration library (v2.1.0) designed for programmatic use as a module, unlike CLI-focused alternatives. It supports multiple databases, backward compatibility with migrate-mongo, and uses transactions by default for data integrity. Requires Node.js >=8.0.0 and MongoDB >=2.6 (or >=4.0/4.2 for transactions). Stable release with TypeScript type definitions included, released under MIT license.
npm install yammyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize Migrate instance, list pending migrations, and apply them. Includes example migration file with up/down functions.
Update constructor to `new Migrate({ uri, options }, { autoClose, dir })`Ensure MongoDB is configured for transactions or set `useTransactions: false` in options.
Add `exports.db = 'your_database_name';` to each migration file.
Use the Migrate class in your application code instead of CLI.
Use `import { Migrate } from 'yammy'` (ESM) or `const { Migrate } = require('yammy')` (CommonJS).Either switch to a replica set or set `useTransactions: false` in Migrate options.
Run `npm install yammy` in your project directory.
Add `exports.db = 'myDatabaseName';` to the migration file.