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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -