mongodb-migrations icon indicating copy to clipboard operation
mongodb-migrations copied to clipboard

support for promises in up/down functions

Open stalniy opened this issue 8 years ago • 2 comments

I'm using nodejs 6.9+ and would like to use built-in Promise libraries instead of done callback. So,

module.exports = {
  up() {
     return this.db.createCollection('tasks')
  },

  down() {
     return this.db.dropCollection('tasks')
  }
}

stalniy avatar Feb 25 '17 06:02 stalniy

In future it will also support async functions and I'll be able to do this:

module.exports = {
  async up() {
     await this.db.createCollection('tasks')
  },

  async down() {
     await this.db.dropCollection('tasks')
  }
}

stalniy avatar Feb 25 '17 06:02 stalniy

https://github.com/emirotin/mongodb-migrations/issues/65

KieronWiltshire avatar Jan 07 '19 23:01 KieronWiltshire