Home > other >  how to check that record updated or not using sequelize
how to check that record updated or not using sequelize

Time:10-26

In this block of code I updated a record of a model IPAdress.

how can I check now that record has updated or not.

let IPAdress = await model.IPAdress.update(data,{ where: { id } });

CodePudding user response:

if index 0 of an array is 0 then it mean that record has not updtaed yet.
let IPAdress = await model.IPAdress.update(data,{ where: { id } });
if(IPAdress[0] == 0) throw "Error Message";
else { print("record has been updated ");
  • Related