skip to Main Content

I’m fairly new to firebase and I’m trying to get the path to one of my subcollections in order to install a firebase extension.

This is how my JSON looks like

firebase-image

The issue is I’m trying to get the subcollection "comments" under each "post" document as required by the extension

extension-configuration

I’m aware I can use collection groups and simply give it "comments" however in my case the path is required by the extension

I tried doing post/comments however it would detect that the path is incorrect and would throw out an error

I tried post/${postId}/comments however that simply wouldn’t work

I know the extension does work because something like /post/c9902c40-6e63-11ed-b700-2d9d4e8231b7/comments does work for that one branch

2

Answers


  1. What you’re trying to enter would be called a "collection group", which is all of the collections with the same name, no matter where they are located. This extension is asking you for just a collection, which means you can specify only one complete path without wildcards (it can’t be a collection group). I’d suggest sending feedback to the author of the plugin and ask for collection group support. I’m guessing you’re using this one:

    https://github.com/conversationai/firestore-perspective-toxicity

    Either that, or put all comment documents in a single collection and point the extension there instead.

    Login or Signup to reply.
  2. It depends on how the extension is written. For example the firestore-bigquery-export extension takes posts/{postId}/comments.

    https://github.com/firebase/extensions/blob/master/firestore-bigquery-export/functions/src/index.ts#L47

    You can inspect the extension’s source code and see how the value passed-in is used to see if it’s supported.

    Edit: looks like you are using the perspective API extension. So you can find how the collection path is used here:
    https://github.com/conversationai/firestore-perspective-toxicity/blob/main/extension.yaml#L46

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