Hey all. Here’s my solution to the ‘APIs and Microservices - Exercise Tracker’ Project.
Any genaral feedback or criticism would be greatly appreciated . I chose to reference the exercises in my user model in my database, so that i can find the users and exercises i want with a single mongoose execution. Is this a valid use case of mongoose references? I’m not really sure as to when to use references and when to not. I mainly do it to prevent nesting mongoose calls within mongoose calls within mongoose calls, basically im wondering what the pros and cons are of doing it how I’ve done it VS finding the user to make sure it’s there, then executing another mongoose find on the exercise collection to get all of the exercises.
Also, in my exercise model, my default date had to be set forward 11 hours (I’m in australia) to be correct. does mongo always convert dates to UTC, if so how do i handle this for multiple timezones ? in the default function for the date of my exercise schema is there someway to offset the hours based on the clients location? I’m trying to have all dates in the database have be at midnight for that day.