I have a real-time database and one of its collections looks something like this:
"VisitorRecords" : {
"1558098355174" : {
"CardReturnApprovedBy" : "IXWjlt15qJPkjNDbl4PqG1cT13",
"CreatedBy" : "IXWjlt15qJPkjNDblqG1cc0T13",
"DatetimeCreated" : "Fri, 17 May 2019 13:05:55 GMT",
"Status": 1
},
"1558445445664" : {
"CardReturnApprovedBy" : "",
"CreatedBy" : "IXWjlt15qJPkjNl4PqG1cc0T13",
"DatetimeCreated" : "Tue, 21 May 2019 13:30:45 GMT",
"Status": 1
}
}
My idea here is to filter all of the visitor records which have their DatetimeCreated bigger or equal to DateTime.Now (UTC) and then I want to update the Status property to 2. I want to do that from a firebase function.
What I've found so far is startAt(), endAt() helper functions but they don't seem to work in my case. Other option is to iterate all of the records and do a manual check for the date. Then, try to update this specific record using .update
I was wondering if there's no more simple and elegant way of doing this.