like:
update user.age = user.age+1 where id=123
try:
models.User.update({age:sequelize.col('age')+1},{where:{id:123}}).success()...
What should I do?
this way you can update with the existing value.
Sequelize.literal('no_of_sub_categorys + 1')
sample code :
CountModel.update({
no_of_sub_categorys: Sequelize.literal('no_of_sub_categorys + 1')
}, {
where: {
category_id: requestData.parent_id,
active: 1
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With