Home > Blockchain >  How do I add a timer inside a firestore document?
How do I add a timer inside a firestore document?

Time:05-16

So I'm trying to create a post block feature for my android app where I want to post block users for x days, is there a way to add a countdown timer as a field inside the firestore document of each user?

CodePudding user response:

You don't do it that way. You mark the timestamp where either they were banned, or the timestamp the ban ends (the 2nd is a bit easier and makes multiple ban lengths easier). Then when they try to do something where they may be blocked, you check if the timestamp is expired or not.

CodePudding user response:

No. You can't add a Timer inside a Firestore document. The only types supported are given below:

  1. String
  2. Number
  3. Boolean
  4. Date
  5. Geo point
  6. Map
  7. Array
  8. null
  9. Reference

Now, the alternative for what you want is already answered by Gabe Sechan

  • Related