I can post a new exercise to an existing id but it doesn’t display when I try to get the logs. Additionally, when i check in MongoDB database there isn’t the entry for the added exercise. So, i can start a new user, add an exercise but then can’t add an additional exercise.
I think there are a few issues here. You are defining Person with two fields–name and log. But you are not adding anything to this log when a new exercise is added. So the log array of a person remains empty (actually, you didn’t initialize to empty array so not sure Mongo will initialize it to or null). Since you’re storing everything in the exercise collection, you actually don’t need the log array in the Person model. Also, I noticed that you comment out the toDateString when returning a log of exercises. Why? You definitely need one. I passed the tests by converting the date using toDateString.
BTW, I define just one model, a Person with username: String and exercises:[{description:String, duration: Number, date: Date}].