Friday 5 May 2017

how to handle nested for each loop which are contains callback in sails.js

I have pseudo code -

foreach(clients){
 foreach(orderids)
   {
    //call asynchronous findOne() 
      if(client_Has_OrderId){
       count++;
       }
    }//close foreach orderids
storeInArray(client,count);
}//close client foreach loop

I am new on sails.js and don't know how to code this in sails.js I have no experience of asynchronous programming.When I code this in synchronous way desire result not get.

result should look like-

client1 1
client2 5
client3 0

Thank you.



via John

No comments:

Post a Comment