Tuesday, 2 May 2017

how to handle asynchronous callback in nested forEach loop in sails.js?

My problem is-

clients.forEach(function(client){
 billids.forEach(function(id){
    Model.findOne().where({clientname:client.name}).where({billid:id}).exec(function(err,record){

//some code is here ` });

}); });

I want to find out each client how many bill ids have i can check using count method but I know synchronous programming I am new in sails.js don't know how to do this in asynchronous way?



via user5266931

No comments:

Post a Comment