[Code](https://i.stack.imgur.com/S3u2i.png)

[Server.js result](https://i.stack.imgur.com/kuV5h.png)

My code is this

```
app.post('/get_page_data', function(req, res) {
function find (i,documents)
{
    Item_data.find({item_name:documents[i].item_name}).exec(function (err,asd){
            console.log(documents[i].item_name+": found");
            console.log(asd[0].like);

    }
    )
}
Page_data.find().lean().exec(function (err, documents) {
var doc=documents;

async.series([
// 1st
function(done){
    for(var i=0;i<documents.length;i++)
{

    find(i,doc);
    done()
}
},
// 2nd
function(done){
    console.log("1");
    console.log(doc);
    console.log("2");
    res.end(JSON.stringify(doc));
    console.log("3");
    done()
}
]);

}
)});

```

I'll introduce my code simply
when ajax called /get\_page\_data
i bring the pages data (page1,page2,page3 ...) in documents
every page has a item\_name but pages data does not have the "like" data
so i find the value of "like" in the other collection(Item\_data) by the same item name and put the "like" in the pages data documents

but this makes me crazy
the pages data is sent before i put the like value

so i read about the non blocking io and async blahblah...
and i found the async module. And used it.
But as you can see the pictures above, they're not working

(before trying async moudle they didn't work neither)

I don't know why res.end part excutes previously and Please tell me the solution of this situation Thank you for reading
------------------------------------------------------------------------------------------------------------------------

[![updated result](https://i.stack.imgur.com/VAkGu.png)](https://i.stack.imgur.com/VAkGu.png)