I am trying to run two different mongoose queries and display the result in same ejs page. I searched a lot and finally found the async method. How I tried this is below.
js file
router.get('/CreateSurvey', function(req, res, next) {
async.parallel([
function(callback) {
QBank.find( function ( err, classes, count ){
classes : classes
});
},
function(callback) {
QBank.findOne({_id:"H001"}, function ( err, questions, count ){
questions : questions
});
}
], function(err) {
if (err) return next(err);
res.render('CreateSurvey', QBank);
});
});
But when I refresh '/CreateSurvey' page it does not render. I have already downloaded async module and required in my js file. Where am I wrong?