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
The issue is I'm trying to get the subcollection "comments" under each "post" document as required by the extension
I'm aware I can use collection groups and simply give them "comments" however 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
CodePudding user response:
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.
CodePudding user response:
It depends on how the extension is written. For example the firestore-bigquery-export
extension takes posts/{postId}/comments
.
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