title: Saving mongoose result in a variable outside a callback
body: <p>I am trying to return found entry from a Mongoose entry on my collection into a variable which the function will return after few more checks. </p>
  
  <p>The current code is getting the document, but I need to access it and return it at the end. Is it possible to assign a return query outside the callback? </p>
  
  <p>The current function: </p>
  
  <pre><code>login_user(username, psw) {
          let hashedPsw = _SECURITY.string_to_sha1(psw);
          let userObject = {};
          webkbuser.findOne({'user_username': username}).exec(function(err, ret) {
              if (err) return _UTILS.errorHanlder(err, false, true, null);
              userObject = ret;
          });
          console.log(userObject);
  }
  </code></pre>
  
  <p>As predicted the console.log returns a '{}' output since nothing is getting assigned to it. </p>
  
  <p>The object is being created in a router and login is being called in if statement atm</p>
  
  <pre><code>    router.post('/', function(req, res, next) {
        if (!req.body) return res.sendStatu(400);
        if (!req.body.usr) return res.sendStatus(400);
        if (!req.body.psw) return res.sendStatus(400);
        let user = new _USER('LOGIN');
        if (user.login(req.body.usr, req.body.psw) === false) return res.sendStatus(401);
        req.session.active = true;
        res.sendStatus(200);
      })
  </code></pre>