sequelize change data before updating rows code example
Example 1: sequelize update
var Book = db.define(‘books’, {
title: {
type: Sequelize.STRING
},
pages: {
type: Sequelize.INTEGER
}
})
Book.update(
{title: req.body.title},
{where: req.params.bookId}
)
Example 2: update data in sequelize
const objectToUpdate = {
title: 'Hello World',
description: 'Hello World'
}
models.Locale.update(objectToUpdate, { where: { id: 2}})