BackEnd Certificate Project ExerciseTracker

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) => {

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 => myLog.push({
    description: d.description,
    duration: d.duration,
    date: new Date('T')[0].split('-')[0],'T')[0].split('-')[1]-1,'T')[0].split('-')[2]).toDateString()

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

  fromDate = new Date(from)

  toDate = new Date(to)

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


  myLog = myLog.slice(0, parseInt(limit))

  username: myUser.username,
  count: myExercise.length,
  _id: id,
  log: myLog


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, for easier debugging.

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