Node.js 7 how to use sequelize transaction with async / await?

前端 未结 6 1213
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 21:43

Node.js 7 and up already support async/await syntax. How should I use async/await with sequelize transactions?

6条回答
  •  庸人自扰
    2021-01-29 22:05

    The above code has an error in destroy call.

     await Model.destroy({where: {id}, transaction});
    

    Transaction is part of the options object.

提交回复
热议问题