umzug-mongo

1.2.1 • Public • Published

umzug-mongo

NPM Package Build Status Commitizen friendly Dependencies

Umzug adapter for mongo migrations.

Usage

Simply pass in your promise-compliant mongodb-core database or collection object.

var Umzug = require('umzug');
var MongoClient = require('mongodb').MongoClient;
 
MongoClient.connect('mongodb://localhost:27017/mydatabase').then(function (db) {
  var umzug = new Umzug({
    storage: 'umzug-mongo',
    storageOptions: {
      connection: db,
      collectionName: 'mymigrations', // defaults to 'migrations'
    },
  });
 
  return umzug.up();
});

or

var Umzug = require('umzug');
var MongoClient = require('mongodb').MongoClient;
 
MongoClient.connect('mongodb://localhost:27017/mydatabase').then(function (db) {
  var migrations = db.collection('migrations');
  var umzug = new Umzug({
    storage: 'umzug-mongo',
    storageOptions: {
      collection: migrations,
    },
    migrations: {
      params: [db]
    },
  });
 
  return umzug.up();
});

Package Sidebar

Install

npm i umzug-mongo

Weekly Downloads

3

Version

1.2.1

License

MIT

Unpacked Size

11.9 kB

Total Files

8

Last publish

Collaborators

  • patrickhulce