Fetching Firestore Documents & Collections

🚧

Make sure you have your Firebase account connected to Draftbit!

See how here: https://docs.draftbit.com/docs/connecting-a-firebase-account

You can access your connected Firestore data at the screen-level of your apps. To do so, you click on the desired screen in the left-hand layer tree, then move to the right-hand panel and select the "Data" tab.

You'll then select "Firebase" as your source.

These components in Draftbit are data-enabled.

Fetching a Collection

If you'd like to map a collection to this screen (for example, to populate a list of items), choose the "Collections" type in the "Data" tab and select the collection you'd like this screen to access.

Then navigate to your "List" in the left-hand layer tree. On the "Data" tab in the right-hand panel you'll select the collection you want to map to this List.

Fetching a Document

Mapping a single document to a screen is similar to mapping a collection. Again choose the desired screen in the left-hand layer tree and in the right-hand panel select the "Data" tab, navigate to your connected Firestore and then select the "Document" type.

Next, choose the data-enabled component in the left-hand layer tree that you want to map your document to. You'll then move back to the "Data" tab in the right-hand panel for that component. There, you will given the option to populate your component with the data in your selected document.

Here's an example of how to do this with a text component:


Did this page help you?