I am doing a side project where I am trying to learn some about firestore, so i am making a hybrid shopping list/work hour tracker web app, here I want to ask about storing work hours in firestore.
Here i have the picture showing the structure i have come up with for my work hour tracker.
Above you can see a date that is an object, or map as firestore calls it, which is a day. This day contains all the start and end dates of the work day(the user can toggle when he/she is working or not).
This way i can display a overall time worked by calculating the difference between "date_start" of the first object and the "date_end" of the last object, in the work_hours array. Also allowing me to visualise a more detailed list with the work hours.
Furthermore if the last object in the array does not have an "date_end" i can know for sure that i have to show a timer that is counting from the last "date_start" to now.
I have tried in multiple ways to update this array, but none worked like i intended them to, the closest i got was with upload method and specifying the path to "work_hours" map. but still i have to re-upload the whole modified array, which does not seem optimal to me... Sure it is not a huge operation, but it is a waste of resources in my mind, which is not necessary.
Now my question is: How to update just the "work_hours" array in this document field without needing to upload it again?
Alternatively: Any suggestions that are able to achieve a similar result or even better result, without needing to re-upload the whole map to the document, which have a different structure from mine.