Exercise tracker : cannot pass test 4

I give up.
I think the code works fine, the only issue might be the ObjectId because it’s being discussed on the forum.
I’ve used it in the schema, in the user creation function and the add exercise function. I can log the typeof and it says ‘object’ but when the json object is returned, I see a string Maybe I’m seeing it’s value and not the entire object.
I’m now at the trial and error stage. Maybe I should create a separate schema for the exercises? A hint pointing me towards ‘exit’ would be enormously appreciated.

Is a url to the exercise enough ?

https://repl.it/@karinmeersman/KarinMeersman-exercisetracker-1#server.js

I had added the functions but I don’t know if that’s ok. Tell me if you want me to post them as well.

Greets,
Karin

Thank you and greets,
Karin

I checked the FCC example and there POST to /api/exercise/add returns a flat object:

{"_id":"602d3b5be2f17305e4681991","username":"foo115","date":"Wed Feb 17 2021","duration":123,"description":"test2"}

, but you have a key exercises with an array with exercise data:

{"_id":"602d3a749d0ef40a1e8baace","username":"fcc_test_16135768197","exercises":[{"description":"test","duration":60,"date":"Mon Jan 01 1990"}]}
1 Like

Hi,

Didn’t see, wouldn’t have seen it in a million years. I have been LOOKING AT THE WRONG TEST!

I was trying to put put an array of exercises in there. OMG, how is it possible?

I’m trying out your suggestion now and will get back.

Thanks a lot,
Karin

Dear Jenovs,

I passed!!! Whollop of a blind spot that was.

Thanks again and greets,
Karin