Skip to content Skip to sidebar Skip to footer

How To Increase Counts In Database Using Javascript Increment Method?

I have field called ads_counter in my database, and I need to increase its value each time when this ad is rendered. I want to implement increment function of javascript in node r

Solution 1:

I think I got The answer I have to add below code in my node api I have to get product_id from the client side and this api will increase the ads_counter by 1.

Product.update({ ads_counter: sequelize.literal('ads_counter+ 1') }, { where: { id: req.body.id } });

this is the link of git issue from where I got my answer

Post a Comment for "How To Increase Counts In Database Using Javascript Increment Method?"