Is there any TTL option on documents for Firebase Firestore . Where documents get auto deleted after that amount time
There is no such built-in functionality.
The easiest way to build it yourself is by:
expirationTimestamp
property to your documents.Denying read of documents whose expiration has passed in your security rules.
match /collection/{document} {
allow read: if resource.data.expirationTimestamp > request.time.date();
}
Unfortunately this means that you won't be able to query the collection anymore. You'll need to access the individual documents.
Periodically run Cloud Functions code to delete expired documents.
Also see Doug's excellent blog post describing this process: How to schedule a Cloud Function to run in the future with Cloud Tasks (to build a Firestore document TTL).