I have collection of consultations with value 'date' with format of TimeStamp (October 31, 2020 at 1:00:00 AM UTC+1). Another value i have is "status" (true/false)
Every TimeStamp has same time, its allways 1:00:00 AM UTC+1.
I would like to set "status" to false, if the date is tomorrow or it has been already gone.
Here is my cloud function that I tried to make by myself:
exports.scheduledFunction = functions.pubsub
.schedule("* 1 * * *")
.timeZone("Europe/Prague")
.onRun(async () => {
const tommorow = new Date().getTime() + 24*60*60;
await firebase.firestore
.collection("consultations")
.where("date" '==' tommorow)
.set((status: false), { merge: true });
});