title: Uncaught (in promise) Error: Request failed with status code 500
body: <p>I have data in the User table, but I can't find a user based on their id - <code>User.findById('kjsdfjsidjisj')</code>. Under the fetchuser function, if I <code>res.send({ user: user_id })</code> it correctly sends back the id in a string format after decoding the JWT token. But when I try <code>user = User.findById({ user_id })</code>, and sending user it gives me an error. Maybe I'm missing something in my query?? </p>
  
  <p>I don't know how to complete this promise, if this is one. </p>
  
  <hr>
  
  <pre><code>const User = require('../models/User');
  const jwt = require('jwt-simple');
  const config = require('../config/dev');
  
  var mongoose = require('mongoose');
  
  function tokenForUser(user) {
      const timestamp = new Date().getTime();
      return jwt.encode({ 
          sub: user.id,
          admin: user.admin
      }, config.secret);
  }
  
  exports.fetchuser = function (req, res, next) {
      const token = req.body.token;
      const secret = config.secret;
      const decoded = jwt.decode(token, secret);
  
      const user_id = decoded.sub;
  
      const user = User.findById({ user_id })
  
      res.send({
          user: user
      });
  }
  </code></pre>