0

FIREBASE FIRESTORE

I have this Firebase collection structured as shown above, What i'm trying to achieve is to be able to know immediately when the expiration_date has been reached so I can send a notification message to the participant that their session has elapsed...

I have tried using pub/sub trigger that runs every 5 minutes, the problem is that won't scale when the channel IDs get bigger as it has to individually scan through the entire collection and check the expiration_date against the current time.

MSadiq
  • 167
  • 11
  • 1
    Cloud Functions can't do this alone. You will need something else to schedule a future invocation, such as Cloud Tasks. – Doug Stevenson Jan 04 '22 at 19:31
  • Also @Doug has a detailed blog on the same [How to schedule a Cloud Function to run in the future with Cloud Tasks](https://medium.com/firebase-developers/how-to-schedule-a-cloud-function-to-run-in-the-future-in-order-to-build-a-firestore-document-ttl-754f9bf3214a) :) – Dharmaraj Jan 04 '22 at 19:34

0 Answers0