参考查询数据的所有条件筛选方法,即where
相关的内容
更新数据
(async () => {
await UserModel.update({
last_name: 'Li'
}, {
where: { last_name: 'Lee' }
});
let users = await UserModel.findAll();
console.log(JSON.stringify(users, null, 2));
})();
删除数据
(async () => {
await UserModel.destroy({
where: {
id: 2
}
});
let users = await UserModel.findAll();
console.log(JSON.stringify(users, null, 2));
})();
网友评论