javascript - Node.js data validation with multiple processes -
i noticed in node.js not easy validate data in db. example have next snippet of code
return dbservice.checkpossibilityaddentitybysomedata(t, data) .then(function(itpossibleadd) { if(!itpossibleadd) { throw new error(); } return dbservice.add(t, entity); })
i add new entity, if query returns true.
but faced situation multiple processes tried add same entity , when 1 process conducted validation still not add entity process add entity. , result wrong data in database.
how deal ?
Comments
Post a Comment