@js-migrations/mongo
v1.0.1
Published
Implementation of the js-migrations RepoFacade using Mongo.
Downloads
3
Readme
mongo
Implementation of the js-migrations RepoFacade using Mongo.
Usage
- Install it with
npm i @js-migrations/mongo
. - Use the factory to create the repository facade.
- Use the facade with the @js-migrations/core service.
Use the factory
import mongoMigrationsRepoFactory from '@js-migrations/mongo/dist/factory';
import connectToDb from '@js-migrations/mongo/dist/utils/connectToDb';
const migrationsRepoFacade = mongoMigrationsRepoFactory({
db: connectToDb({
dbName: 'your_db_name',
url: 'mongodb://127.0.0.1',
}),
// Optional property.
collectionName: 'migrations',
// Optional property.
lockCollectionName: 'migrationsLock',
// Optional property.
migrations: [{
down: async () => {},
key: 'your_migration_name',
up: async () => {},
}],
});