app.get('/index', function(req, res){
Activities.find({}, function(err, activity){
if(err){
console.log(err);
}else{
res.render('index', {activities:activity});
}
});
Upcoming.find({}, function(err, upcomingActivity){
if(err){
console.log(err);
}else{
res.render('index', {upcoming:upcomingActivity});
}
});
});
I just want to get data of multiple collections and then pass it to index.ejs file so that i can use these data there. I know using res.render() multiple times won't work but i have tried many things like saving founded data to variable , creating an object of these etc. But nothing worked.