Search code examples
firebasefirebase-extensions

is Firebase delete user data extension capable to delete all documents in deleted user subcollections?


I wanna try Firebase extension delete user data.

Say in Firestore I have path like this

users/{uid}/inbox/{messageID}

and also

users/{uid}/posts/{postID}

My question is ....

Is Firebase extension delete user data capable to delete all user message documents, and all users posts documents in Firestore ?

from the documentation in here, it seems it can only delete the document that has the same uid in the root main collection only for Firestore. am I right?


Solution

  • From the same documentation you linked:

    Configuration Parameters:

    ...

    Cloud Firestore delete mode: (Only applicable if you use the Cloud Firestore paths parameter.) How do you want to delete Cloud Firestore documents? To also delete documents in subcollections, set this parameter to recursive.

    When you install the extension, you should see a prompt for this parameter and answer recursive:

      - param: FIRESTORE_DELETE_MODE
        label: Cloud Firestore delete mode
        description: >-
          (Only applicable if you use the `Cloud Firestore paths` parameter.) How do
          you want to delete Cloud Firestore documents? To also delete documents in
          subcollections, set this parameter to `recursive`.
        type: select
        options:
          - label: Recursive
            value: recursive
          - label: Shallow
            value: shallow
        default: shallow
        required: true