I think you should wrap "ProductVariations ..." in the promise. And wait until this is decided. And then call the next iterator.
This code should solve your problem.
let promiseProductVariations = function (valueSU, keySU) { return new Promise(function (resolve, reject) { ProductVariations.findOne({id:valueSU.id}).exec(function (ePV,dPV){ dPV.available_stock = parseInt(dPV.available_stock) - Qty; dPV.save(function (errDPV) { if(errDPV){ reject(errDPV); }else{ resolve();
source share