Registry / database / mongoose-migrate-2

mongoose-migrate-2

JSON →
library0.2.5jsnpmunverified

A migration framework for MongoDB using Mongoose, forked from madhums/mongoose-migrate with two improvements: eliminates the need to configure Mongoose schema/model name (model is auto-named 'Migration'), and config file is a Node module supporting environment variables. Version 0.2.5 is the latest stable release, designed for Node >= 0.8.x. It stores migration state in MongoDB, tracks executed migrations, and supports up/down commands. Key differentiators: simpler configuration, no hard-coded JSON config.

npm install mongoose-migrate-2
INSTALL
IMPORT
SIG · MONGOOSE-MIGRATE-2
M
mongoose-migrate-2
databasejavascriptv0.2.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

migrate
import migrate from 'mongoose-migrate-2'
const migrate = require('mongoose-migrate-2')
Package is CommonJS only; no named exports.

Shows configuration file setup with environment-specific database URLs.

// migrations/config.js module.exports = { development: 'mongodb://localhost:27017/myapp_dev', production: process.env.MONGODB_URL || 'mongodb://localhost:27017/myapp' };
Debug
Known issues
deprecatedPackage is no longer maintained; last updated 10+ years ago. Use migrate-mongo or mongodb-migrate instead.
fix
Migrate to migrate-mongo (https://www.npmjs.com/package/migrate-mongo)
affects: *
gotchaConfig file must be a Node module exporting an object with keys matching NODE_ENV values.
fix
Ensure config file exports module.exports = { environment: url };
affects: *
gotchaMigrations are stored in ./migrations/ directory; cannot be customized without options.
fix
Use -c/--chdir to change working directory, but default path is fixed.
affects: *
Errors
Common errors & fixes
Cannot find module './config'
Missing or incorrect config file path
fix
Set MIGRATION_CONFIG_PATH env variable to your config file path.
Upgrade
Version history
0.2.5latest on npm
Audit
Dependencies
mongooserequiredRequired for MongoDB connection and model definition
Agent activity
7 hits · last 30 days
node
6
Resources
mongoose-migrate-2 — npm install mongoose-migrate-2 · libregistry