Exercise Tracker Project 5th test

I’m stuck at the 5th test. Apparently, everything looks rigth, but I can’t pass the test. here’s the code of my route:

app.get( '/api/exercise/log/:userId', async( req, res ) => {
	try{
		const findUserResult = await UserModel.findById( req.params.userId ).populate( 'exerciseList').exec();		
		let exerciseList = findUserResult.exerciseList.map( exercise => ({
			description: exercise.description,
			duration: exercise.duration,
			date: exercise.date.toDateString()
		}));	
		res.status( 200 ).json({
			_id: findUserResult._id,
			username: findUserResult.username,
			log: exerciseList,
			count: exerciseList.length
		});
	}
	catch( err ){
		console.error( error.message );
		res.status( 500 ).json({
	 		message: err.message,
	 		content: err
	 	});
	}
});

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

1 Like