Exercise Tracker-add exercise don't work

I am trying to get this excercise tracker to work, but with no luck. I can’t pass add excercise request.
Request is :“I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercise/add. If no date supplied it will use current date. App will return the user object with the exercise fields added.”
This is my code :

//Define user schema
const userSchema = new Schema({
  _id: {
    type: String,
    default: shortid.generate
  username: String,
}, { versionKey: false });

//Define user model
const User = mongoose.model('user', userSchema);

const exerciseSchema = new Schema({
  username: String,
  description: String,
  duration: Number,
  _id: String,
  date: Date,
}, { versionKey: false });

//Define exercise model 
let Exercise = mongoose.model('exercise', exerciseSchema);

//add new exercise
app.post('/api/exercise/add', (req, res, next) => {
//  console.log(req.body);
  let { userId, description, duration, date } = req.body;
  date = !date ? new Date() : new Date(date);
  User.findById({ _id: userId }, (err, user) => {
    if (err) return next(err);
    new Exercise({ username: user.username, description: description, duration: duration, _id: userId, date: date }).save((err, exercise) => {
      if (err) return next(err);
      return res.json(exercise);

Challenge: undefined

Link to the challenge:

Welcome, dragan.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


The test case has a strict date validation format. The test will fail unless you return a format like this

Sun Jun 21 2020