javascript - Sequelize, how do I get current value of updating row? -
how current value of row i'm update? have findone query before update, in order find previous value? here's want do:
update usermodels set nonce = nonce + 1 u_id = 1
is there way make work here? how [current value of nonce]? have separate query?
return usermodels.update({ nonce: [current value of nonce] + 1 },{ where: { u_id: 1 } } );
as docs say, updated value of object should retrieved again. @lj_1102 commented this link here on api implementation can see better explanation.
refer reload if cant reload instance , prevent creating again
Comments
Post a Comment