Firestore sub-collection

Hello. Are we able to query a sub-collection in Firebase? If so what is the method to access them?

Thank you.

1 Like

Hey Brett - to query a subcollection you'll want to set up a normal Firestore query, but make sure to select "use raw id" beside the collection input. Then, we just need to supply the path to a subcollection - something like users/idOfASpecifcUser/subCollectionName.

In Retool, the nice pattern here is to include the user id as a dynamic variable, something like users/{{table1.selectedRow.data._id}}/subCollectionName.

Hopefully the screenshot explains everything!

3 Likes