@neo9/n9-mongodb-migration
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

n9-mongodb-migration

Project to run migration script on mongodb.

npm version Build Status Coverage

simple usage :

import { N9MongodbMigration } from '@neo9/n9-mongodb-migration';

const mongodbPatchApplier = new N9MongodbMigration({
	migrationScriptsFolderPath: './scripts',
	mongodbURI: process.env.MONGODB_URI,
});

await mongodbPatchApplier.apply();

Scripts names :

x.y.z_dscription-of-the-upgrade.js

Script example :

async function up(db, log) {
	await db.collection('test').insertOne({
		test: true,
	});
}

async function down(db, log) {
	await db.collection('test').deleteOne({
		test: true,
	});
}

module.exports = { up, down };

More examples can be found in the tests folder.

Package Sidebar

Install

npm i @neo9/n9-mongodb-migration

Weekly Downloads

40

Version

1.0.0

License

GPL-3.0-or-later

Unpacked Size

29.2 kB

Total Files

26

Last publish

Collaborators

  • cribeiron9
  • n9-dsabatier
  • fmarion
  • benjd90
  • cballesta
  • mrskyce