umzug-mongo
1.2.1 • Public • Published umzug-mongo
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',
},
});
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
Weekly Downloads