title: callback not fetching record in nodejs
body: <p>i want to pass email in <code>postman</code> and want to print the fetched <code>json data</code> to <code>console</code>. but it is not <code>fetching any data</code>. so help me to solve this issue</p>
  
  <p>mongoconnect.js</p>
  
  <pre><code>var MongoClient = require('mongodb').MongoClient;
  var url = "mongodb://localhost:27017/";
  var dbo=null;
  
  exports.connection=function(){
      if(dbo!=null) return 
  
    MongoClient.connect(url, function(err, db) {
    if (err) throw err;
     dbo = db.db("hospital_api");
  
  });
  }
  
  var get = function (){
      return dbo;
  }
  
  exports.email=function(r){
      get().dbo.collection("doctor").find({"email":r}).toArray(function(err,result)
      {
          if(err) throw err;
          console.log(result)
          return result;
      })
  }
  </code></pre>
  
  <p>doctor.js</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  var bodyParser = require("body-parser");
  var validator = require('validator');
  var mongo= require('./mongoconnect')
  var app = express();
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  router.post('/',function(req,res)
      {
          d=mongo.email(req.body.email)
          console.log(d);
      })
  
  module.exports = router;
  </code></pre>