Exercise Tracker: Don't understand what is being asked

Im struggling to understand what is required for this task - I’ve spent way too long just getting through the first three tasks, and now number 4 I think I have done but its not passing the test … I dont understand why though. My output is as:

{ _id: 5ebe97206bf87c329d26a430,
  userName: 'fcc_test_15895488317',
   [ { _id: 5ebe97206bf87c329d26a431,
       description: 'test',
       duration: 60,
       date: '1990-01-01' },
     { _id: 5ebe97206bf87c329d26a433,
       description: 'test',
       duration: 60,
       date: '1990-01-02' } ],
  __v: 0 }

The test description says : “…return the user object with the exercise fields added”, which I think I am doing … ?
Can someone advise what is being asked here?

Many thanks in advance

Edit: I missed count in the output, and suspect that activities should be called log, so the output is now as below - still no passing the test though:

{ _id: 5ebeb09ee25c3315f6604bfc,
  username: 'fcc_test_15895553583',
  count: 2,
   [ { _id: 5ebeb09fe25c3315f6604bfd,
       description: 'test',
       duration: 60,
       date: '1990-01-01' },
     { _id: 5ebeb09fe25c3315f6604bff,
       description: 'test',
       duration: 60,
       date: '1990-01-02' } ] }

Is your date of type date or string? Because i spent over four days on the same exercise.
Check This forum post. Someone posted a similar question.

I saw that one thanks! It’s infuriating cos it does’nt tell me how I am failing the test…

In answer to your question I’ve tried both ways, at first I was storing as Date, and then as String, but I cant get either way to work. If I store as Date the output I get is this format:


Do I need to do some conversion on it?

Mine passed without converting into a more readable format.

Could you confirm what the expected output for task 4 should be? The last line of the description is “App will return the user object with the exercise fields added.” - does this just mean the exercise fields that were added, or all of the exercise fields for the user? I have now interpreted the intention as:

{ _id: 5ebecfd0914f3b4fc49e12cc,
  username: 'fcc_test_15895633448',
  description: 'test',
  duration: 60,
  date: 1990-01-02T00:00:00.000Z }

_id and username are the user object, with the new exercise fields description, duration and date added - as per the description… But still, its not working., arrrggghhh.

OK, I finally got it. The format of the return object was ok, but I had to do toDateString on the returned MongoDB date:

date: activityDoc.date.toDateString()

I wasted about 4 hours on that - It would have been a whole bunch quicker if the documentation was clearer.

Hello there,

The most reliable way to get what the tests want is by going to the source code:

I realise this is not ideal, and many of the projects/lessons are being re-worked, but this is a good opportunity for you to practice some backend debugging.