erick21

Untitled

Apr 30th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. var thisQuery = tableModel.find();
  2. thisQuery.select('name');
  3. thisQuery.sort('name');
  4. thisQuery.where('status', 'Active');
  5. thisQuery.exec(function(err, items) {
  6. if (err){
  7. console.log('######## '+new Date()+', SOCKET iWantListName RUN : ' + err);
  8. }else{
  9.  
  10. async.each(items,function(eachItem,callbackEach) {
  11.  
  12. var listQuotaTripNew = [];
  13. var index = 0;
  14. eachItem.quota_trip.forEach(function(eachQuotaTrip) {
  15.  
  16. listInputannya.forEach(function(eachInputannya) {
  17. if(index == eachInputannya.index) listQuotaTripNew.push(eachInputannya.value);
  18. else listQuotaTripNew.push(eachQuotaTrip);
  19.  
  20. index++;
  21. });
  22. });
  23.  
  24.  
  25. tableModel.update({
  26. '_id' : eachItem._id
  27. },{
  28. $set: {
  29. 'quota_trip' : listQuotaTripNew
  30. }
  31. },function(error,result) {
  32. callbackEach();
  33. });
  34. }
  35. },function(errEach) {
  36.  
  37. });
  38. });
Advertisement
Add Comment
Please, Sign In to add comment