💾Data Schemas
From v4.4.0, we have added to the plugin the possibility of linking "data types" do documents read from a Firestore Data List, Firestore Data Single or Firebase Auth (Current User) elements.
Since v4.5.0, Firebase Data Extractor and Firebase Data Processor elements also receive the "data schema" option.
That mean you can define a type of "thing" on Bubble's API Connector an use it to map the fields of your Firestore Documents, making the extraction of data from the document fields as easy as selecting a property in a Bubble "thing".
Here is how to do it
Install the Bubble API Connector on your Bubble app

Click on "Add another API"

Click on "Add another call"
Give the API Call the name you want your document type to have (e.g. "task"). Make sure the "Data type" of the call is "JSON".

Click on the "Manually enter API response" option

Get a sample, in JSON, of the Firestore document you want to create a schema to, and paste it on the popup window.

Hit "Save" and choose how you'd like each field to be treated from Bubble. For instance, as a text, number or date.

Important! Reference fields must be treated as texts. The plugin will always convert firestore reference objects into a path to the document (e.g. tasks/document_id)
Now, on one of the supported element, you can define the "data schema" as "task"

Then, you can access the document's fields from the "data (w/ schema)" state.

Last updated