Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7647073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:22:22+00:00 2026-05-31T10:22:22+00:00

I want data from multiple collection and then want to merge all data. i

  • 0

I want data from multiple collection and then want to merge all data. i am using async module for sequential execution. i wrote code like

var newArray = new Array();
        common.findAllById('list',{'boardId': parseInt(bId)},function(err,result){                            
                if(err) console.log(err);
                else{                                                            
                    if(result != null){                          
                        async.forEachSeries(result, function (res, callback){                                
                            common.findAllById('cards',{'listId':parseInt(res.listId)},function(err,temp){
                                if(err){ callback("errr"+err);}
                                else{                                     
                                    var arr = new Array();
                                    async.forEachSeries(temp, function(tmp,callbackFn){
                                        common.findAllById('checklist',{'cardId':parseInt(tmp.cardId)}, function(err,r){
                                             if(err){ 
                                                 callbackFn("errr"+err);
                                             }
                                             else{
                                             if(r !== null){
                                                console.log("r:");

                                                tmp.checklists = r;                                                
                                                arr.push(tmp);                                                
                                                callbackFn(err);
                                             }
                                             }
                                        });                                        
                                    },function(err){ 
                                        console.log('arr'); 
                                        res.cards = arr; 
                                         console.log(res);
                                    });
                                    newArray.push(res);
                                    callback(err);
                                }                                                                
                            });                            
                        }, function (err){
                            console.log('after:');
                            console.log(newArray);                                                        
                            return response.send(newArray);
                        });                        
                    }
                }
            });

in this code after completing inner(second) foreach loop callback function for first foreach loop sholud called but after first iteration of second foreach loop first loop’s callback is called and then it continues with second foreach loop iteration. what is mistake in this code please help me.
thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:22:24+00:00Added an answer on May 31, 2026 at 10:22 am

    You should call callback() of first forEachSeries into the the final callback of the inner forEachSeries.

    },function(err){ 
        console.log('arr'); 
        res.cards = arr; 
        console.log(res);
        newArray.push(res);
        callback(err);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple SharePoint lists and want to display data from them on to
I want display data from database in Listbox...Here is my code, It is not
I want sync data from iphone to the webs server. My question is how
We want to replicate data from one database to several others (on another server).
i want use some data from a website with web service. i have a
I want to take data from a table that'll be almost exactly similiar to
I want to get data from two tables. I have patient first name and
I want to cache data from a json-webservice in my android app. The first
I want to pull data from a database to display into a ComboBox, and
I want to get data from a table in my MySQL database. $linkID =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.