參考查詢數(shù)據(jù)的所有條件篩選方法眯杏,即where
相關的內(nèi)容
更新數(shù)據(jù)
(async () => {
await UserModel.update({
last_name: 'Li'
}, {
where: { last_name: 'Lee' }
});
let users = await UserModel.findAll();
console.log(JSON.stringify(users, null, 2));
})();
刪除數(shù)據(jù)
(async () => {
await UserModel.destroy({
where: {
id: 2
}
});
let users = await UserModel.findAll();
console.log(JSON.stringify(users, null, 2));
})();