I need help with this syntax
var Category = require("../models/category");
app.get("/", function(req, res){
 var categories = findCategory();
 res.send(categories);
});
function findCategory() {
 Category.find({})
    .populate("subCategories")
    .exec(function(err, categories) {            
     if (err) {
      req.flash("error","Error while retrieving information from database");
      res.redirect("back");
     }
     return (categories);
  });
};
Result is undefine .. I do not seems to understand why
I should return this
[ { subCategories: [ [Object], [Object], [Object] ],
_id: 5b58fe38a9281b21d07fc094,
title: 'Web, IT & Software Dev',
description: 'PHP, Wordpress, HTML, JavaScript and many more',
__v: 3 },
 { subCategories: [ [Object] ],
_id: 5b58fe4aa9281b21d07fc095,
title: 'Mobile Phones & Computing',
description: 'Mobile App Development, Android, iPhone, iPad, Amazon Kindle..',
__v: 1 },]
Please Help!!!. Thanks
 
    