Hi, I completed the project but I passed none of my challenges. Is there something wrong with my code because i saw it fit perfectly of the stucture and still not pass, thank you
I am also trying this and any of the test fields mentioning “user object” are confusing me having tried returning a literal {user: ..} object as well as sending the returned mongo query on it’s own. Step 12 to 15 as well, does the test suite want you to create null log entries for new users or an empty log array? Because neither are working.
are there errors in the console when you run the tests? if you find that you have CORS errors, there should be someone on the forum explaining how to make your app surpass those
for me 1 line of code was the reason half the test suite failed, i somehow was grabbing the id from req.body instead of req.params, and then for #8 I didn’t realise the test suite specifically wanted the user’s _id instead of the exercise id.
longest time ive spent debugging a certification lol
Thanks for sharing this — I’m currently stuck with the date part. So just to confirm: if no date is sent in the POST request, we should auto-fill it with the current date in .toDateString() format?
First you have to make sure that the type of your date property is Date and set it’s default by Date.now in mongo and then you just have to return the exercise.date.toDateString() and there you go
Hi, i saw so many error in the console most of it was about blocked by CORS’s policy, Please let me know what I can do now to pass the test, thank you!
Ummm…You know what? I just have to put the middleware that use cors on top and then every challenges was pass but whatever thanks yall stayed with me and i really appreciate that!
I did the same thing, but it threw some kind of error, it looks like it isn’t connecting to mongoose.
at NativeConnection.createClient (C:\Users\ROBHE\OneDrive\Desktop\New folder (2)\exercise-tracker\node_modules\mongoose\lib\drivers\node-mongodb-native\connection.js:237:11)
at NativeConnection.openUri (C:\Users\ROBHE\OneDrive\Desktop\New folder (2)\exercise-tracker\node_modules\mongoose\lib\connection.js:1071:34)
at Mongoose.connect (C:\Users\ROBHE\OneDrive\Desktop\New folder (2)\exercise-tracker\node_modules\mongoose\lib\mongoose.js:450:15)
at Object. (C:\Users\ROBHE\OneDrive\Desktop\New folder (2)\exercise-tracker\index.js:12:10)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49