Created
September 2, 2016 07:28
-
-
Save ermst4r/9af6088fed74f1a64f48d4af9497cc2c to your computer and use it in GitHub Desktop.
psuodo code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var counter = 0 // count when the foreach is done | |
retailers.forEach(function(retailer) { | |
retailer.siteid=siteid; | |
retailer.month=month; | |
retailer.year=year; | |
prim_id =md5(siteid+month+year+retailer.storeid); | |
retailer.prim_id=prim_id; | |
//sails.log(retailer); | |
Retailers.updateOrCreate({prim_id:prim_id},retailer,function createFindCB(error, createdOrFoundRecords){ | |
console.log('Store Updated'+retailer.storeid+'?'); | |
counter++; // count where the foreach is done.. | |
}); | |
}); | |
if(counter == retailers.length) { | |
resolve(true); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment