I'm still very new to node.js,the array over here consists a list of ids. When I'm sending the response from the forEach loop, I'm getting Error: Can't set headers after they are sent.
I googled it but could not understand properly
array.forEach(function(data) {
db.collection.find({
_id: mongoskin.helper.toObjectID(data)
}).toArray(function(err, data1) {
if (err) return next(err);
console.log(data1);
res.send(data1);
})
})