Back End Development and APIs Projects - Exercise Tracker

Tell us what’s happening:
Describe your issue in detail here.


Despite the fact that my server returns the date in any object of the log array as a string, I keep receiving this error.

// running tests
The date property of any object in the log array that is returned from GET /api/users/:_id/logs should be a string. Use the dateString format of the Date API.
// tests completed

Your project link(s)

solution: boilerplate-project-exercisetracker - Node.js Repl - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

Hello!

I can see a problem with your result:

In the image you can see the date is not valid, which may be because it’s undefined, null, or have any other value. You should check that on the database.

Also, as a recommendation, don’t limit your results after you’ve queried the database, apply the limit to the query instead:

User.findById(_id, (err, data) => {
  // Here you handle the results
}, { limit: 10 });

This way the database doesn’t have to retrieve all the data.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.