Is there any TTL option on documents for Firebase Firestore . Where documents get auto deleted after that amount time
Firebase offers two cloud-based, client-accessible database solutions that support realtime data syncing: Cloud Firestore is Firebase's newest database for mobile app development. It builds on the successes of the Realtime Database with a new, more intuitive data model.
256 MB from the REST API; 16 MB from the SDKs. The total data in each write operation should be less than 256 MB. Multi-path updates are subject to the same size limitation.
10 for single-document requests and query requests. 20 for multi-document reads, transactions, and batched writes. The previous limit of 10 also applies to each operation.
Firestore in Datastore mode Eventual consistency: Datastore queries become strongly consistent unless you explicitly request eventual consistency. Queries in transactions are no longer required to be ancestor queries. Transactions are no longer limited to 25 entity groups.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With