Hi I am new to Firestore and working with a Swift project. My aim is to have an insert of data, which the user will insert.
However I want to be able to achieve a day total for each day I enter a new value and then update this value every time I insert a new entry. Would this be able to be done through firebase functions or will I require another route which is less expensive to achieve this. Sorry if this doesn't make sense I will try to provide some samples of what I am trying to achieve:
So for instance I will be making an entry which will follow this data format in JSON.
{
[userId] : [{
trackingData:[
{ [random id]: { value: 15 }, timestamp: 22 Feb 2022 },
{ [random id]: { value: 10 }, timestamp: 22 Feb 2022 },
]
}]
}
My question is basically is there a way to have calculate the total day value of the tracking data per day. Using Firestore.
Edit...
The structure is quite simple as shown above when a user enters a record its saved on to its user id as reference. Then placed in its own trackingData collection. Where the results are then saved in a form of an array, where each entry is a single object.