skip to Main Content

To define an index in firestore you can use, firestore.indexes.json. Is there a way to define TTL properties in a similar way, so those are automatically deployed when switching environment (dev, staging, prod) ?

2

Answers


  1. Chosen as BEST ANSWER

    Although not documented it seems like it is possible to define TTL policies like this:

      "fieldOverrides": [
        {
          "collectionGroup": "fcm_tokens",
          "fieldPath": "expiresAt",
          "ttl": true,
          "indexes": []
        }
      ]
    

    in firestore.indexes.json

    Here is a PR adding the documentation in the repository readme


  2. The Firebase CLI doesn’t support this, or at least not in a documented way. File a feature request on the firebase-tools GitHub to make your needs known for that.

    You can use gcloud to set ttl policies programmatically instead.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search