Create table from firestore subcollection

Hi,
I have a root collection in firestore with some settings-related documents. Some of them have different subcollections.
I’d like to have a table that deals with a specific subcollection, however, JetAdmin is not even showing me the subcollection.

Structure:
settings

  • entities
    • users → That’s the one I want
  • roles
    • permissions

Thank you!

@dudi In order to display a nested collection you need to pass documentID (path) to which this nested collection belongs, this is not a requirement of Jet Admin, this is what Firebase API requires to display the corresponding data for the corresponding record. I recorded you a video on how it can be done in different ways: Loom | Free Screen & Video Recording Software

Thanks. I saw this video in the other thread.
The issue is that I don’t see the “Related components” or the subcollection I’m looking for in the list of collections.

If your sub-collections are in an empty collection (no data structure), this structure is considered invalid and JetAdmin will not be able to display your sub-collections, but we will fix this in the future. You need to add at least one data field to the parent collection for this.

Could you please send a screenshot of your parent collection as it looks like?

1 Like

Excellent. Indeed the parent document was empty. Once I added a field to it, and reloaded the source, it loaded the sub-collection successfully.

Thank you!

Actually, the table itself doesn’t work.
I do see in the data sources manager, but that’s what happens when I try to add a table with the documents:

Does the parent path field expect something different than the name of the parent document?

1 Like

Please look carefully:

In order to display a nested collection you need to pass documentID (path) to which this nested collection belongs, this is not a requirement of Jet Admin, this is what Firebase API requires to display the corresponding data for the corresponding record. I recorded you a video on how it can be done in different ways: Loom | Free Screen & Video Recording Software

@dev It should work the same way as in my record above :slight_smile:
You just need to pass parent (documentId) to load corresponding collection for selected row

I try to post multiple screenshots but it is forbidden. multiple links are forbidden too. i will try again later :disappointed_relieved:

1 Like

Could you please invite me to the project with admin permissions so I’ll be able to check it?

1 Like

The default filter in the 2nd Table is “elements.Table[“0”].selected_item.jet_pk ” and it doesn’t work.

If I change it to “elements.Table[“0”].selected_item.jet_item_pk ”, it doesn’t work either.

thank you! i sent the invite link in a dm to you.
hmm i think i sent it. did i send it successfully?

Hi @JetTeam , did the link i sent you work? :slight_smile:

@dev
Yes, I just accessed your project through the invitation link - thank you!

I looked at your project, you created a demo table with one record, and the fact that you can’t display the data from the related collection is because you simply don’t have child data for parentId (documentId).

@dev@jetadmin.io Could you please try to re-connect your Firebase using Direct mode (not Sync in Jet Tables mode) and try the same? :slight_smile:

Hi, thank you
In the data tab I deleted the Firestore source and used ‘Add Resource’ button to add it back again, but it was the same.
This is how I added the table: Record_2022_07_12_14_25_35_858.mp4 - Google Drive
And this is my data structure. I am not sure what you mean ‘don’t have child data for parentId (documentId)’. What should i type for the formula of the table?

Again thank you!

@dev Please connect Firebase via Direct mode, not Sync mode. You actually connected it via Sync mode again.

Hi, thank you!
Yeah finally found ‘Direct’ mode option and the sub collection worked. Thanks for your help!
Was reading about ‘Sync’ mode and I was wondering I would chose sync mode only when i want to sync multiple database (e.g., Firestore and Airtable) ?
And why was the sub collection somewhat not working as i expected in sync mode vs direct mode?

I’ll investigate this issue as Sync mode still in public beta testing and let you know.