Im trying to write an if statement in Node.js with some mongoose query but the if statement does not get executed correctly.
So I'm doing this:
app.get('Job/GetJobs', function(req,res){
if(JobDB.Find()==null){
req.render('home.html');
}
else req.render('Job.html')
})
But the above code works if it was in java but not in Node.js because req.render('home.html'); gets executed before JobDB.find() finishes.