Subcollection firebase


I’ve successfully created a POST request using HTTP request for creating records in a sub collection.I’m using the base and name field as the url in a variable to achive dynamic url POST requests.

The trouble is there are many sub collection with different document IDs so how do I create a schema to view sub collections with dynamic document ID? I’m stuck with creating a sub collection with a static document ID from the url. See the picture below. I’m trying to make the ID circled in yellow dynamic and not static. It being static means I can only view ne collection. Soif I delete the sub collection and another random id is created? I loose visibility of my schema.

I’ve managed to sort it out. You simply remove the document id in the url and give it an id with the curley brackets {id} while ceating a collection. That makes it dynamic.

Only challenge is the name cannot work because the id needs to be a single text and not a path. The work around is to use a Javascript andm make use of the fact that a document id only has 20 characters. So I used this code to get only the ID from the entire path. Code

return { result: inputs.group_id.slice(inputs.group_id.length-20, inputs.group_id.length) };

This code gives me the id alone which I can include on the url to get the full path of the sub collection and use it to build a dynamic schema. Hope I’ve explained well.