Save does not appear to work. How can this be solved?

Tell us what’s happening:
Save does not appear to work because the res.json is not returned. How can this be solved?

// define the database
var userSchema = new mongoose.Schema({
  username: String,
  _id: String,

// create the Model
var User = mongoose.model('User', userSchema);"/api/exercise/new-user", (req, res) => {
  var _id = shortid.generate();
  var username = req.body.username
  var user = new User({ username: username, _id: _id});{ username: username }, (error, data) => {
    if (err) return console.error(err);
    if (data) {
        username: username,
        _id: _id

Your code so far

Your browser information:


Challenge: Exercise Tracker

Link to the challenge:

How can it be done, any ideas?