BackEnd Certificate Project ExerciseTracker

Hey,
I am working on the BackEnd Certification path and currently stuck with the ExerciseTracker Project.

My code passes all the tests but the last one.
There is no error in the console, it just says Timed Out

I think this code is correct, why is the test failing? Is there any test constraint other than what the result says?

Test Result:

You can add from, to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back. (Test timed out)

My Code:

app.get(’/api/users/:_id/logs’, async(req,res) => {

try{
const {from, to, limit} = req.query;
const id = req.params._id;

let myUserDoc = await User.findById(id)

let myUser = myUserDoc.toObject();

let theUser = {
  userId: id
}

let myExercise = await Exercise.find(theUser)

let myLog = []
await myExercise.map(d => myLog.push({
    description: d.description,
    duration: d.duration,
    date: new Date(d.date.split('T')[0].split('-')[0],d.date.split('T')[0].split('-')[1]-1,d.date.split('T')[0].split('-')[2]).toDateString()
  }))

if(from || to){
let fromDate = new Date(0)
let toDate = new Date()

if(from){
  fromDate = new Date(from)
}

if(to){
  toDate = new Date(to)
}  

myLog = myLog.filter((exerciseItem) =>{
    let exerciseItemDate = new Date(exerciseItem.date)
    
    return (
      exerciseItemDate.getTime() >= fromDate.getTime()
      && 
      exerciseItemDate.getTime() <= toDate.getTime())
  })

}

if(limit){
  myLog = myLog.slice(0, parseInt(limit))
}

res.json({
  username: myUser.username,
  count: myExercise.length,
  _id: id,
  log: myLog
})

}
catch(err){
console.log(err)
}
})

Try logging the route inputs and responses to make sure the route is actually running during the test and to see what the input actually is. Then, add console.log() messages in the route until you find the spot where the error happens so that you’ll know what to investigate (it’s probably coming from either findById() or find()).

You could also post a link to your code in a repl, like at repl.it, for easier debugging.

Thank you, I will try logging and debugging.
Meanwhile please take a look at my repl: boilerplate-project-exercisetracker - Replit