Project.find({ where: { title: 'aProject' } })
.on('success', function (project) {
// Check if record exists in db
if (project) {
project.update({
title: 'a very different title now'
})
.success(function () {})
}
})
models.User.destroy({where: {userID: '유저ID'}})
.then(result => {
res.json({});
})
.catch(err => {
console.error(err);
});
var Book = db.define(‘books’, {
title: {
type: Sequelize.STRING
},
pages: {
type: Sequelize.INTEGER
}
})
Book.update(
{title: req.body.title},
{where: req.params.bookId}
)