Vladimir37 Vladimir37 - 6 months ago 20
Node.js Question

Sequelize push values

How to make push values in Sequelize, analogical SQL-request

UPDATE table SET fields = fields + 'test'
?

Example:

table.find({where: {id: 1}}).then(function(result) {
console.log(result.name); //returned 'abc'
})

//actions ( + 'test')

table.find({where: {id: 1}}).then(function(result) {
console.log(result.name); //returned 'abctest'
})


(Sorry for bad english)

Answer
table.find({where: {id: 1}}).then(function(result) {
    result.name = result.name + 'test';
    result.save();
})
Comments