Data Schemas
Last updated
Last updated
From v4.4.0, we have added to the plugin the possibility of linking "data types" do documents read from a , or elements.
Since v4.5.0, and elements also receive the "data schema" option.
That mean you can define a type of "thing" on 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".
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.
You can you our "" to turn the raw JSON string returned by elements into a "data schema" you can you on the API Connector.