我知道如何更新 sequalize
中的特定字段Project.update(
{
title: 'a new value'
},
{
where: {id: 1}
})
.success(function () {
})
.error(function () {
}
);
但是,我想更新整行的值/字段。
{
"field1":"foo",
"field2":"bar",
"field3":"bar2"
}
网站上的文档不是很清楚: http://docs.sequelizejs.com/en/latest/api/model/
答案 0 :(得分:1)
只需将具有新数据的对象作为第一个参数传递给更新函数
Project.update(
{
title: 'a new value',
field1: "foo",
field2: "bar"
},
{
where: {id: 1}
})