Currently, my team is developing a web application that utilizes wearables to monitor vital parameters. As part of our integration testing, we are using a Fitbit device. The app itself is built with Angular and JavaScript, while the database is hosted on Cloudant. I am seeking advice on how to maintain updated database entries in a general sense. Specifically, I would like to gather wearable data every two hours and update an existing entry for the same day instead of creating duplicates.
At this point, I have considered two potential solutions:
- Storing today's data, including the entry's ID, in a variable to be updated periodically, resetting it at midnight.
- Prior to each update, retrieving all entries and checking for one matching today's date. If found, updating that existing entry; otherwise, creating a new one.
I'm not entirely satisfied with these options and would appreciate any guidance or alternative approaches.
Thank you in advance.