Hi there, I have two tasks to do:
1. Mongo Call ---> simple find with query
2. Searching in the result of Mongo find with forEach and making another 
request to different collection..
3. res.send changes which have been done in forEach loop.

For now it looks like that:

 db.collection.find().sort({ "rank": order }).skip(pagenumber).limit(5, 
function (err, result) {

            currData = result;
           
        });
 find(currData); 
   res.send(currData);


and find is a function() like  :

function find(db) {
    db.forEach(function (prevResult) {
        db.collectionOther.find({ MID: commId }, function (error, result) {
            result.forEach(function (r) {  
       some calculations;
                if (condition) {
                  prevResult= Calculations; 
                }               
            });
        });
    });
     

I tired to do it whit process.nextTick but failed. Could someone help mi to 
make the calls be done after each other and not at the same time?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/548ab906-3f1e-48ff-92b3-165cd795ff24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to