# Table of Contents - [Field types table | Firebase Auth, Firestore & Storage (plugin)](#field-types-table-firebase-auth-firestore-storage-plugin-) - [Getting Started | Firebase Auth, Firestore & Storage (plugin)](#getting-started-firebase-auth-firestore-storage-plugin-) - [Get Firebase access credentials | Firebase Auth, Firestore & Storage (plugin)](#get-firebase-access-credentials-firebase-auth-firestore-storage-plugin-) - [Secure your credentials and data | Firebase Auth, Firestore & Storage (plugin)](#secure-your-credentials-and-data-firebase-auth-firestore-storage-plugin-) - [About elements | Firebase Auth, Firestore & Storage (plugin)](#about-elements-firebase-auth-firestore-storage-plugin-) - [Security Rules on Firebase | Firebase Auth, Firestore & Storage (plugin)](#security-rules-on-firebase-firebase-auth-firestore-storage-plugin-) - [Offline Support | Firebase Auth, Firestore & Storage (plugin)](#offline-support-firebase-auth-firestore-storage-plugin-) - [Firestore Data Extractor | Firebase Auth, Firestore & Storage (plugin)](#firestore-data-extractor-firebase-auth-firestore-storage-plugin-) - [Create a Firebase Project | Firebase Auth, Firestore & Storage (plugin)](#create-a-firebase-project-firebase-auth-firestore-storage-plugin-) - [Restrict your api-key to your domain | Firebase Auth, Firestore & Storage (plugin)](#restrict-your-api-key-to-your-domain-firebase-auth-firestore-storage-plugin-) - [Firebase Auth (Current User) | Firebase Auth, Firestore & Storage (plugin)](#firebase-auth-current-user-firebase-auth-firestore-storage-plugin-) - [Firestore Data (legacy) | Firebase Auth, Firestore & Storage (plugin)](#firestore-data-legacy-firebase-auth-firestore-storage-plugin-) - [Firebase Geohash | Firebase Auth, Firestore & Storage (plugin)](#firebase-geohash-firebase-auth-firestore-storage-plugin-) - [Data Schemas | Firebase Auth, Firestore & Storage (plugin)](#data-schemas-firebase-auth-firestore-storage-plugin-) - [Firestore Data Single | Firebase Auth, Firestore & Storage (plugin)](#firestore-data-single-firebase-auth-firestore-storage-plugin-) --- # Field types table | Firebase Auth, Firestore & Storage (plugin) The table below contains (1) the keywords you should use in actions that require you to define field types and (2) a description of how they will be interpreted and in which format you should provide data to avoid inconsistencies. Since all data must be provided as text, the plugin will convert this text into a "type" based on the keywords you use. We left more than one keyword for each type, in order to help no-codes to choose terms they're more familiar with. Keywords Description and how to format the value boolean bool Turns "0", "no" and "false" texts into a boolean value of false, and turns any other values into the boolean value of true. text Treats the entry as a simple text field. number Tries to convert the value into a number. Will result in error if it's not possible and won't store the value. date timestamp map json array list object json object Tries to convert the text into a JSON object, that will be stored as a Map or Array type on Firestore. If the conversion fails, it won't store the value. Sample Array: \["text1", "text2", "text3"\]. Sample Map: {"prop1": "text1", "prop2": 10, "prop3": "text3"} This only supports texts or number types on the JSON structure. You can also construct Maps by using dot notation, which allows you to define more types. For instance, you can store a "date" on the key "log.date" and it will store a Map {"date": date\_value} on the "log" field. reference Tries to create a document reference from a path given as text. For instance: users/doc\_id will be turned into a reference to the users collection, to the document of ID "doc\_id". For subcollection, you only need to provide the full path: users/doc\_id/subcollection/sub\_doc\_id. reference list Tries to create an array of references from a list of paths provided as strings. It is important to provide the list as an javascript array. For instance: \["users/doc\_id1","users/doc\_id2","users/doc\_id3"\] add to list add item to list add list list add Tries to add a value or an array of values to a list field as texts. If the field was not of type array, it will be turned into one. Sample: \["text1"\] or text1 will add "text1" to an array. remove from list remove item from list remove list list remove Tries to remove a value or an array of values form a list field. Sample: \["text1"\] or text1 will remove "text1" to an array. list add number add number to list add number list add list number Tries to add a number or an array of number to a list field. If the field was not of type array, it will be turned into one. Sample: \[123\] or 123 will add the number 123 to an array. list remove number remove number to list remove number list remove list number Tries to remove a number or an array of number from a list field. Sample: \[123\] or 123 will remove the number 123 to an array. list add date add date to list add date list add list date Tries to add a date or an array of dates to a list field. If the field was not of type array, it will be turned into one. Sample: \["2024-02-21T00:00:000Z"\] or 2024-02-21T00:00:000Z will add this date to an array. list remove date remove date to list remove date list remove list date Tries to remove a date or an array of dates from a list field. If the field was not of type array, it will be turned into one. Sample: \["2024-02-21T00:00:000Z"\] or 2024-02-21T00:00:000Z will remove this date to an array. list add map add map to list add map list add list map list add json add json to list add json list add list json Tries to add a map / json or an array of maps / jsons to a list field. If the field was not of type array, it will be turned into one. Sample: \[{"message":"Hello","id":1}\] or {"message":"Hello","id":1} will add this json string as a map type to an array field. list remove map remove map list remove list map list remove json remove json list remove list json Tries to remove a map / json or an array of maps / jsons from a list field. If the field was not of type array, it will be turned into one. Sample: \[{"message":"Hello","id":1}\] or {"message":"Hello","id":1} will remove this json string as a map type to an array field. list add reference add reference to list add reference list add list reference Tries to convert a list of paths into a list of references to be added to a list field on a document. Sample: \["users/doc\_id1", "users/doc\_id2"\] will be added to the list as 2 references to documents on the users collection. list remove reference remove reference from list remove reference list remove list reference Tries to convert a list of paths into a list of references to be removed from a list field on a document. Sample: \["users/doc\_id1", "users/doc\_id2"\] will be removed from the list. geopoint location geographic location Tries to convert a latitude and longitude into a GeoPoint reference to be stored on Firestore. Sample: 40.6976312,-74.1444872 (lat,lng) will store a reference to New York on a GeoPoint type field. delete delete field Deleted a field from the JSON structure on the document. This tyep does not require any value. If one is given, it will be ignored. increment Increments a number field by the specified value. Sample 1: 2 will add 2 units to a numeric field. Sample 2: \-1 will subtract 1 unit from a numeric field. [PreviousAbout front-end actions](/firebase-auth-firestore-and-storage-plugin/plugin-front-end-actions/about-front-end-actions) [NextFirestore](/firebase-auth-firestore-and-storage-plugin/plugin-front-end-actions/firestore) Last updated 9 months ago Tries to convert the value into a datetime value. Best practice is to use ISO Format provided by Bubble's date formatter (2023-12-14T00:00:00.000Z-03:00) πŸ’Ύ ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FEjzMKLxRbphUdPadrFrt%252Fimage.png%3Falt%3Dmedia%26token%3Db31fef69-dd0b-455d-ad04-94c9d0866922&width=300&dpr=4&quality=100&sign=5be9eb9&sv=2) --- # Getting Started | Firebase Auth, Firestore & Storage (plugin) This plugin was created by [Estare](https://estare.com.br/en) , a no-code software development company. We help you materialize you business idea! Our plugin aims to give you more freedom and flexibility in regards of which database to use in your Bubble projects, as well as help you saving workload unit consumption. We allow you to connect to the authentication, firestore (database) and cloud storage features from the Google Firebase services. [](#setup-your-plugin) Setup your plugin --------------------------------------------- 1. [Create a Firebase Project](/firebase-auth-firestore-and-storage-plugin/setup/create-a-firebase-project) 2. [Get Firebase access credentials](/firebase-auth-firestore-and-storage-plugin/setup/get-firebase-access-credentials) 3. [Security Rules on Firebase](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/security-rules-on-firebase) [](#plugin-elements) Plugin Elements ----------------------------------------- 1. [Firebase Auth (Current User)](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-auth-current-user) 2. [Firestore Data List](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) 3. [Firestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) 4. [Firestore Data Aggregation](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-aggregation) 5. [Firestore Data Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-processor) 6. [Firebase Storage Upload Button](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-storage-upload-button) 7. [Firebase Dropdown Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-dropdown-processor) [](#plugin-front-end-actions) Plugin Front-End Actions ----------------------------------------------------------- 1. [Firestore](/firebase-auth-firestore-and-storage-plugin/plugin-front-end-actions/firestore) 2. [Firebase Auth](/firebase-auth-firestore-and-storage-plugin/plugin-front-end-actions/firebase-auth) 3. [Firebase Storage](/firebase-auth-firestore-and-storage-plugin/plugin-front-end-actions/firebase-storage) [](#plugin-back-end-actions) Plugin Back-End Actions --------------------------------------------------------- 1. [About backend actions](/firebase-auth-firestore-and-storage-plugin/plugin-back-end-actions/about-backend-actions) 2. [Firestore Backend](/firebase-auth-firestore-and-storage-plugin/plugin-back-end-actions/firestore-backend) 3. [Firebase Auth Backend](/firebase-auth-firestore-and-storage-plugin/plugin-back-end-actions/firebase-auth-backend) [NextCreate a Firebase Project](/firebase-auth-firestore-and-storage-plugin/setup/create-a-firebase-project) Last updated 10 months ago πŸš€ ![Page cover image](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FTv8IOtvfgeLP5dUbgebJ%252FFrame%25201171276746.png%3Falt%3Dmedia%26token%3Dcff1bda2-8712-43bf-931f-10c41efa01c3&width=1248&dpr=4&quality=100&sign=30fb39f1&sv=2) --- # Get Firebase access credentials | Firebase Auth, Firestore & Storage (plugin) [PreviousCreate a Firebase Project](/firebase-auth-firestore-and-storage-plugin/setup/create-a-firebase-project) [NextOffline Support](/firebase-auth-firestore-and-storage-plugin/setup/offline-support) Last updated 10 months ago Here you'll see how to get your app ready for use on Bubble and how to get the credentials you need to enter on the plugin settings. [](#basic-settings-for-front-end-actions) Basic settings for front-end actions ----------------------------------------------------------------------------------- ### [](#id-1-on-the-firebase-console-of-your-project-click-on-the-next-to-the-project-overview-menu-button-and) 1- On the Firebase Console of your project, click on the βš™οΈ next to the "Project Overview" menu button and on "Project Settings" ### [](#id-2-on-the-general-tab-go-to-the-button-and-create-a-new-web-app.-you-can-give-it-any-name-you-like) 2- On the "General" tab, go to the button and create a new Web App. You can give it any name you like. ### [](#id-3-on-the-created-web-app-under-the-same-tab-general-select-the-config-option.-it-will-show-a-json-ob) 3- On the created Web app, under the same tab "General", select the "Config" option. It will show a JSON object notation with all the credentials you need to add on the plugin settings. [](#service-account-for-backend-actions) Service Account for backend actions --------------------------------------------------------------------------------- For you to use the plugins Backend actions, you'll need to add a **service account** credential to the plugin. Follow the steps below. ### [](#id-1-back-to-the-project-settings-on-the-firebase-console-go-to-the-service-account-tab-and-click-on-th) 1- Back to the "Project Settings" on the Firebase Console, go to the "Service Account" tab and click on the "Generate new private key" button ### [](#id-2-on-the-opened-popup-click-on-generate-key-do-download-a-.json-file-that-contains-the-configuration) 2- On the opened popup, click on "Generate key" do download a ".json" file that contains the configuration data for our plugin ### [](#id-3-open-the-file-on-a-notepad-copy-its-contents-and-paste-them-on-the-service-account-json-field-on-t) 3- Open the file on a Notepad, copy its contents and paste them on the "Service Account JSON" field on the plugin settings. Click on Project Settings Get each information on the JSON object (apiKey, authDomain, projectId and so on) and copy them to the plugin settings. These first credentials are enough to run front-end actions. Click on "Generate new private key" Click on "Generate key" Open the .json file and copy its contents. Copy the .json file content on the "Service Account JSON" field on the plugin settings. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FklaOD3xnmv79gDIQnPe7%252Fimage.png%3Falt%3Dmedia%26token%3Dcacf81ce-3320-4558-baa0-67f7c9893d5a&width=768&dpr=4&quality=100&sign=7ea2f253&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FS1pbmHyguU4Z7bfhq1Is%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%286%29.png%3Falt%3Dmedia%26token%3D911970fe-1693-4799-ae0f-c74266696a02&width=768&dpr=4&quality=100&sign=12f2bed9&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F6bS5DWn1K98M56tIsxiu%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%288%29.png%3Falt%3Dmedia%26token%3D89347e86-2a03-44fd-82bd-3ac8fe22a501&width=768&dpr=4&quality=100&sign=5280de10&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FsCMn4JJc9NwbpEdKoj7W%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2810%29.png%3Falt%3Dmedia%26token%3D594031c5-6237-4a40-b0ed-37aa34205116&width=768&dpr=4&quality=100&sign=468a840b&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F9n29ZV02QLhMgsmlAb4b%252Fimage.png%3Falt%3Dmedia%26token%3D2bcb1864-273a-47f0-a603-857b9f21d9a8&width=768&dpr=4&quality=100&sign=4accf6fd&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FG3rzA6aWuQ4UKGMsxmx1%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2811%29.png%3Falt%3Dmedia%26token%3D41095809-58d2-4441-b1e3-d2b9619e26b2&width=768&dpr=4&quality=100&sign=9656ce4&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fw6gynWF0DRW8NIAwjrX6%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2812%29.png%3Falt%3Dmedia%26token%3Dfca5ef5d-228a-4b11-8031-4697e3896876&width=768&dpr=4&quality=100&sign=4a84158a&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FMN6f49RrQn2Yew88kl3P%252Fimage.png%3Falt%3Dmedia%26token%3Dcaaaf92a-5da5-4d38-b5c9-8e331a313d52&width=768&dpr=4&quality=100&sign=9ac7680f&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F8VtUtMI7tiaXSc82Dcv1%252Fimage.png%3Falt%3Dmedia%26token%3D4e391dd6-ac60-423e-bf5a-2cae73d9d1f4&width=768&dpr=4&quality=100&sign=388bcc0&sv=2) --- # Secure your credentials and data | Firebase Auth, Firestore & Storage (plugin) [PreviousOffline Support](/firebase-auth-firestore-and-storage-plugin/setup/offline-support) [NextRestrict your api-key to your domain](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/restrict-your-api-key-to-your-domain) Last updated 9 months ago To operate fast and on the front-end, the Firebase plugin must expose your Firebase App credentials. This poses a security risk for your business, if not dealt correctly. Follow the instructions below on how to secure your app and keep using the power of Firebase without any concerns. [Security Rules on Firebase](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/security-rules-on-firebase) [Restrict your api-key to your domain](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/restrict-your-api-key-to-your-domain) --- # About elements | Firebase Auth, Firestore & Storage (plugin) [PreviousSecurity Rules on Firebase](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/security-rules-on-firebase) [NextData Schemas](/firebase-auth-firestore-and-storage-plugin/plugin-elements/data-schemas) Last updated 10 months ago The plugin firebase and firestore elements are bunches of code that get added to the page when you position them on it. The elements will be invisible to the user, but keep in mind they can mess with your UI. To avoid it, you can set the width and height to 0px. The actions performed by the elements are run when they are loaded to the page, so you can control when they run the first type using the visibility settings. Each element stores a various states that will contain your data and allow for a variety of filters and settings to best suit your need. [](#the-plugin-elements) The plugin elements ------------------------------------------------- Element Description Get information on the current user authenticated using the Firebase Authentication service. Performs a query to get a list of documents from a Firestore collection. Convert latitude and longitude into a geohash for you to store on a document. This is required to perform geoqueries, in which you sort data from geolocation. A JSON reader, that helps you to get data from fields on document data returned by queries. Performs a query to get a single document from a Firestore collection. Performs an aggregation query (count, sum or average) in a Firestore collection. Gets a list of documents or an array of JSONs and allows to filter and sort them on the front-end, without making new queries to Firestore. Allows to upload files to Firebase Storage. Helps to display entire documents on Bubble's Dropdown elements, by choosing which field to display. [](#tip-wait-until-all-your-inputs-are-ready-before-making-the-element-visible) ⚠️Tip: Wait until all your inputs are ready before making the element visible ------------------------------------------------------------------------------------------------------------------------------------------------------------------ Keep in mind that, because the query operations run on the front-end, Bubble sometimes messes with the order in which data arrives from Firestore. That means you must account that factor while using results of other Firebase elements as input data in other query elements. For instance, if you want to get documents form the "tasks" collection where the "owner" filter equals the current user's document reference, you can use the filter bellow (owner == users/Firebase Auth's User ID). But if the User ID is not yet available, the query will fail due to security rules on Firestore. To work around that, you can put a visibility conditional on the Firestore Data element, for it to show only when the User ID is not empty. As the query will only occur when the element is "visible" on the page, it will wait for when the User ID is available to run the query, avoiding the error. Keep that in mind when fetching data from Firestore. πŸ› οΈ [Firebase Auth (Current User)](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-auth-current-user) [Firestore Data List](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) [Firebase Geohash](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firebase-geohash) [Firestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) [Firestore Data Single](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-single) [Firestore Data Aggregation](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-aggregation) [Firestore Data Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-processor) [Firebase Storage Upload Button](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-storage-upload-button) [Firebase Dropdown Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-dropdown-processor) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FYCCZrRd4RniMElq0dE1j%252Fimage.png%3Falt%3Dmedia%26token%3D6db6785a-7940-4ac8-8290-78f1385cf008&width=768&dpr=4&quality=100&sign=8cabc405&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F64ndk7wyjgZpJ3f3cbxj%252Fimage.png%3Falt%3Dmedia%26token%3D263f56c2-2b7c-4ac0-8b6b-a21a266c90e3&width=768&dpr=4&quality=100&sign=d5145639&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FSE3Uvl3dMWihfpj81wC8%252Fimage.png%3Falt%3Dmedia%26token%3Dae266481-348c-4cb4-9523-750877344a59&width=768&dpr=4&quality=100&sign=885ec2cd&sv=2) --- # Security Rules on Firebase | Firebase Auth, Firestore & Storage (plugin) [PreviousRestrict your api-key to your domain](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/restrict-your-api-key-to-your-domain) [NextAbout elements](/firebase-auth-firestore-and-storage-plugin/plugin-elements/about-elements) Last updated 10 months ago In order to run fast operations on Bubble's front-end and also allow for no-code configuration, when you specify the Firebase account configuration of the site, this data might be exposed on the page HTML content. Because of that we strongly recommend every developer to properly configure Security Rules for Firestore and Firebase Storage. To do so, you must go to your projects console, on the Firestore or Storage pages, and click on the "Rules" tab. You must always configure your Security Rules for Firestore and Firebase Storage properly, to avoid unwanted uses of you Firebase connection. [](#using-backend-workflows-for-better-security) Using backend workflows for better security ------------------------------------------------------------------------------------------------- When you use backend actions from the plugin, as they run server-side code, they can bypass security rules, but there is a caveat: Bubble's backend actions for plugins are always slow to start! They take up to 30 seconds to execute, no matter how simple their login is. That's because they kind of need time on first run to "load themselves into Bubble's server memory" (that not an official statement from Bubble, but rather how we rationalize it). After this first execution, they tent to run faster for a couple of minutes. So, you can use them when you need a more secure way to deal with data on Firebase, but you'll have to work around the long execution times limitation and deal with a greater Workload Consumption because of that. Tip: You can run backend operations on a Scheduled Backend Workflow, in order to free your users from the "burden" of having to wait the server-site action warm up time. [](#bubbles-privacy-rules-x-firebase-security-rules) Bubble's Privacy Rules x Firebase Security Rules ---------------------------------------------------------------------------------------------------------- Firebase security rules work differently from Bubble's privacy rules. While on Bubble they work as a kind of "filter" for data, on Firebase they work as "blockers". So, if you define the rule on Bubble that User's can only see their own data, if you try to fetch more user's in a list or a Repeating Group, for instance, no matter how you set the search, Bubble will only give the user's available data. It will simply not fetch the other user's. In Firebase, on the other hand, if you set the same rule, the entire query will fail and you won't receive any data, only an error message on your browser's Console: "Firestore Data Plugin Error: Missing or insufficient permissions." Tip: You can open your browser's dev tools (press "F12") to read any errors or warning messages given by our plugin. Firestore Data Plugin Error: Missing or insufficient permissions. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fh961tkUFRJ3MPn0dbjPl%252Fimage.png%3Falt%3Dmedia%26token%3D793a6ecf-7f07-4c44-bdc3-fab8b2361300&width=768&dpr=4&quality=100&sign=e8b2f70e&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FCXlIGBKaTaCCQ8Cglen7%252Fimage.png%3Falt%3Dmedia%26token%3Dc0e4fc21-c644-45f3-a953-a7e778208c39&width=768&dpr=4&quality=100&sign=446f0a21&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FXoK7e2XVvAVKLET5Fmvm%252Fimage.png%3Falt%3Dmedia%26token%3D366e940b-67dc-4daa-b1fe-ef4c01d79782&width=768&dpr=4&quality=100&sign=292c578e&sv=2) --- # Offline Support | Firebase Auth, Firestore & Storage (plugin) [PreviousGet Firebase access credentials](/firebase-auth-firestore-and-storage-plugin/setup/get-firebase-access-credentials) [NextSecure your credentials and data](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data) Last updated 9 months ago Firebase has native support to an offline feature, that allows you to query and post data from and to the user's browser cache, instead of the server, when there is no connection available. When an internet connection is available again, it sends the changes to the server. You can explicitly activate this feature on the plugin when you specify "offline support" as "true" on the plugin settings (see image below). Before v5.0.0, this feature was enabled by default, but we decided to make it optional, since offline support is not always a requirement for business in general, specially when build on Bubble.io. Also, sometimes working with cached data might lead to some inconsistencies, because the offline changes uploaded to the server will be considered the most recent ones. Here is a video where the Firebase team themselves provide a great explanation about how the offline support works on Firebase: [https://www.youtube.com/watch?v=oDvdAFP6OhQ](https://www.youtube.com/watch?v=oDvdAFP6OhQ) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FI3dWmCVBJHpQpYRmuSRk%252Fimage.png%3Falt%3Dmedia%26token%3Db863abc6-8695-4ee2-8e61-bfa0b0d531e1&width=768&dpr=4&quality=100&sign=415243a9&sv=2) --- # Firestore Data Extractor | Firebase Auth, Firestore & Storage (plugin) [PreviousFirestore Data (legacy)](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firestore-data-legacy) [NextFirestore Data Single](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-single) Last updated 10 months ago The Firestore Data Extractor element can be used to get fields from the JSON structure of documents fetched from Firestore. It processes a single document in order to get it's fields and translate them in data types the Bubble can comprehend. * * * [](#settings) Settings --------------------------- ### [](#document-data) Document Data Here you must specify the id (or name) of the collection of document in Firestore where you chose to store user data. The plugin will fetch data from the document in that collection that has the same ID as the current authenticated user. ### [](#fields-1-2-3) Fields (1, 2, 3, ...) The name or path (in dot notation) of the field you want to extract from the document. For instance, if you you want to extract the content of the field "description" on the document, that's the name you should put on this setting. If the field is of type Map, you can use "dot notation" to extract the value of a specific key on the map. In the example below, a field of name "links" has two keys, "pt-br" and "en-us". To get the value from the "pt-br", the Field would be "links.pt-br". If you don't specify a path and only provide "links" as a path, the entire Map JSON structure can be used as a text. This JSON text can be used in another Data Extractor to get specific fields from it too. ### [](#field-list-1-2-3) Field List (1, 2, 3, ...) The name of the array/list field you want to extract from the document. The generated state will be turned into a Bubble list of values. If the list is a list of "Map" types, you can feed them to a [Firestore Data Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-processor) , to treat them as a list of documents and extract data further. ### [](#field-types-1-2-3) Field Types (1, 2, 3, ...) Choose between the Bubble's basic data types, so that the value of the Field you're extracting can be translated to it. This can end up in error's, like if you try to provide a text to a field you defined as number, so be careful with what you choose and check your browser's console (press "F12") to look for errors. Some data types on Firestore must be treated as texts on Bubble if you want to display them or use them elsewhere, like "Maps" or "References". "Reference" types will be displayed as a text showing the path to the document, like so: collection\_name/document\_id (e.g. tasks/6KXLqGVsvGdytOI5pB8F or users/6n6tlWXTDwUp3f7yQ95mpITUUmZ2) * * * [](#states-and-values) States and Values --------------------------------------------- The Data Extractor provides, for each field you get, a corresponding state containing it's value. It also provides some other useful data, like the originating document id, for instance. ### [](#document-id) Document ID The ID of the processed document. This ID is available in the JSON structure under the key "\_id", but is extracted by default. ### [](#data-w-schema) Data (w/ schema) The JSON data, interpreted through the "data schema" you define on an API Connector and provide to the element. See how to configure this on the [Data Schemas](/firebase-auth-firestore-and-storage-plugin/plugin-elements/data-schemas) documentation. ### [](#field-1-2-3) Field (1, 2, 3, ...) The value extracted from the field, translated to the Field Type you defined for it. ### [](#field-list-1-2-3-1) Field List (1, 2, 3, ...) A list of values extracted from an array field on the document, each entry translated to the Field Type you defined for it. ### [](#error-message) Error message Stores the last error message on the element, if there was any. ### [](#data-is-ready) Data is Ready Turns to "yes" when all the element's states are done being filled, an "no" when they are being filled. Although this operations are fast, the fact the they are filled in order and not at the same time may lead to issues, that's why this state was created. ### [](#keys) Keys The list of paths on the provided data. It gives you all the possible Fields you can extract from the data you provided. If the document has a Field of type "Reference" that points to another document, this list can become long, as the reference JSON object has lots or properties that do not interest us. [](#events) Events ----------------------- ### [](#data-ready-or-changed) Data ready or changed Triggered when the data from the extractor is all loaded and ready to be used. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FpcjF4i7AauxneP4PI2Ch%252Fimage.png%3Falt%3Dmedia%26token%3D75f967cb-0da1-4896-81ea-5d1beb304c23&width=768&dpr=4&quality=100&sign=cb16b93d&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fr8AKNEt6xMEN3bxVHVnC%252Fimage.png%3Falt%3Dmedia%26token%3D5368ce40-321a-4771-ae1c-e12b9d92ed30&width=768&dpr=4&quality=100&sign=7a411498&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FhLG2Lnt9a2jvHVnzV8XE%252Fimage.png%3Falt%3Dmedia%26token%3De1b248eb-f087-4d75-936b-f95dcd2f1009&width=768&dpr=4&quality=100&sign=b03809a&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FQ0X2ibyVg0zWHaJmFoZh%252Fimage.png%3Falt%3Dmedia%26token%3D55c7435a-103b-4581-be2c-fde8a9657da8&width=768&dpr=4&quality=100&sign=a3847c48&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FuFwZpDfEy17YpIwC1Q85%252Fimage.png%3Falt%3Dmedia%26token%3D8a7747dc-cbc2-457a-9a74-ee2e31aeaff1&width=768&dpr=4&quality=100&sign=65ea7512&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FWNaEeNKf1jRVLAIDYVmP%252Fimage.png%3Falt%3Dmedia%26token%3D25c4038f-a82f-4145-a5e6-38fa8d40e366&width=768&dpr=4&quality=100&sign=f5e939ca&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FPvMZghF6GzD4ahM2fGHy%252Fimage.png%3Falt%3Dmedia%26token%3Dc6c6d751-7281-49dd-972a-eaf6709e0f9a&width=768&dpr=4&quality=100&sign=a5946526&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FcNWtJTtWrCvviWvzhghS%252Fimage.png%3Falt%3Dmedia%26token%3Dbba356af-d672-4145-a84d-81ec89378de2&width=768&dpr=4&quality=100&sign=661019a6&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F2q3eYaDtWfOaIcws6BMY%252Fimage.png%3Falt%3Dmedia%26token%3Db3540edf-6857-4dfb-a582-2db6c2d71d59&width=768&dpr=4&quality=100&sign=467fedef&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FsgONplJnBiT0Ko2Y176C%252Fimage.png%3Falt%3Dmedia%26token%3Dc5879cff-c7aa-42ee-9a74-a99a2fac4dfd&width=768&dpr=4&quality=100&sign=17f96d7b&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FRXE6tnZgkPVPQb1ILWLP%252Fimage.png%3Falt%3Dmedia%26token%3D866727f3-4a2b-4ce5-95ff-c85e9150c56b&width=768&dpr=4&quality=100&sign=42b0c875&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FqzvkWQ3Qx8fkpeUP526d%252Fimage.png%3Falt%3Dmedia%26token%3D1efa8353-ffae-4179-9fbb-2d8249912b2a&width=768&dpr=4&quality=100&sign=a3af36b7&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FYAfT4tpL1qdvN03Ulqzh%252Fimage.png%3Falt%3Dmedia%26token%3Dfea5ada2-09f7-4e44-aa8f-3db4183422e3&width=768&dpr=4&quality=100&sign=a8cb0ca1&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F5fWROEUY2dYo11Y97wJV%252Fimage.png%3Falt%3Dmedia%26token%3Dcb49166c-7fe2-4cbd-8ccf-735b28a03fde&width=768&dpr=4&quality=100&sign=5e8ad0b4&sv=2) --- # Create a Firebase Project | Firebase Auth, Firestore & Storage (plugin) [PreviousGetting Started](/firebase-auth-firestore-and-storage-plugin) [NextGet Firebase access credentials](/firebase-auth-firestore-and-storage-plugin/setup/get-firebase-access-credentials) Last updated 9 months ago For the following steps, you must have an account configured on Google Cloud or Google Firebase Console. [](#add-a-new-project) Add a new project --------------------------------------------- ### [](#id-1-access-https-console.firebase.google.com) 1- Access [https://console.firebase.google.com/](https://console.firebase.google.com/) . ### [](#id-2-click-on-add-project) 2- Click on "Add Project". ### [](#id-3-choose-a-name-to-your-project-for-your-reference-only-uncheck-the-google-analytics-optional-featur) 3- Choose a name to your project (for your reference only), uncheck the Google Analytics optional feature (unless you want to use it) and wait for the process to finish. [](#initialize-services) Initialize services ------------------------------------------------- ### [](#id-4-initialize-the-authentication-service-by-click-on-the-the-menu-build-greater-than-greater-than-aut) 4- Initialize the Authentication service, by click on the the menu "Build" >> "Authentication". On the "Sign-in method", you can choose and configure the "Email/Password" login, "Google" or "Facebook". #### [](#id-4.1-allow-your-app-domain-on-the-authentication-settings) 4.1- Allow your app domain on the Authentication settings On the Settings tab of the Authentication service, remember to always add the domains in which you'll use your authentication services. ### [](#id-5-initialize-the-firestore-database-service-clicking-on-build-greater-than-greater-than-firestore-da) 5- Initialize the Firestore Database service, clicking on "Build" >> "Firestore Database" and them on the "Create database" button. When prompted to the region of your database, you can choose between "multi-region" options or localized servers. The latter are faster if you choose one closer to your customers, and a bit cheaper, but the "multi-region" ones have a slightly higher guaranteed up-time (99.999% againts 99.99% - both are good, though). It you're not sure which to choose, you can go with the "nam5" default option. ### [](#id-6-last-but-now-least-initialize-the-storage-service-by-clicking-on-build-greater-than-greater-than-s) 6- Last but now least, initialize the Storage service, by clicking on "Build" >> "Storage". There you go, now go to the next section to see how to configure your newly created project for it to be ready for use on Bubble and how to get the credentials you'll need to att to the plugin settings. Name your app (for reference only) Click on "Authentication" Click on Get Started Click on "Create database" Choose a region for the database server. Click on "Get started" ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FascniD8I9jKdHLAas95t%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%281%29.png%3Falt%3Dmedia%26token%3D07a62eef-0780-45c6-b462-c5da6df60c94&width=768&dpr=4&quality=100&sign=2486dcdc&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FG2jkcdxjQEe6VTEItoQY%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%284%29.png%3Falt%3Dmedia%26token%3D0d93f0da-5d0e-43a0-a913-a9fa2ffaffce&width=768&dpr=4&quality=100&sign=b8d6d9c9&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F7xNUK20LRsc63veT3dAc%252Fimage.png%3Falt%3Dmedia%26token%3D0f011f1e-0857-4c00-9cb3-78d4c5c180cb&width=768&dpr=4&quality=100&sign=fa3b2711&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FYpnS7SnEI8vsFcnxLIdt%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2814%29.png%3Falt%3Dmedia%26token%3D40be2c28-eb2b-4561-8e02-4795db84629c&width=768&dpr=4&quality=100&sign=4a9b0384&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fp4m7xr6ZLXwpLm0cz052%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2815%29.png%3Falt%3Dmedia%26token%3Dd002c98e-82c3-4c02-9faa-5eecc433bbcb&width=768&dpr=4&quality=100&sign=a230a358&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F9knR4OWGLdX2It6ITsd0%252Fimage.png%3Falt%3Dmedia%26token%3D9b00acce-39b6-4c60-816c-2f98a7efaa54&width=768&dpr=4&quality=100&sign=8902b256&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FDIZO3lp6tzcuLKaX89lO%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2820%29.png%3Falt%3Dmedia%26token%3Db8a52aa3-b7a5-4a7e-b107-74c7c47ed65c&width=768&dpr=4&quality=100&sign=654545ed&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FZ9SRVzzecbUaktgOfT8O%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2821%29.png%3Falt%3Dmedia%26token%3D1fa85161-db2d-4052-9042-5139eae0bc14&width=768&dpr=4&quality=100&sign=70b5d822&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FaOYXlr0lD8kRlXDxOFxO%252Fconsole.firebase.google.com_u_0_%28Laptop%29%2520%2824%29.png%3Falt%3Dmedia%26token%3D3f384ba2-a914-439b-96c1-c242afcb3c18&width=768&dpr=4&quality=100&sign=d2487ac8&sv=2) --- # Restrict your api-key to your domain | Firebase Auth, Firestore & Storage (plugin) [PreviousSecure your credentials and data](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data) [NextSecurity Rules on Firebase](/firebase-auth-firestore-and-storage-plugin/setup/secure-your-credentials-and-data/security-rules-on-firebase) Last updated 8 months ago A good way to secure your app is to restrict any front-end api-key to be accessible only on the domains you choose. Firebase automatically configures the api-key for us, but this key is currently unrestricted. To restrict the domains that can use it, we must go to Google Cloud API console. The URL to do so will be something like: Remember, you can see your app ID on the Firebase Console, settings (see image below). [](#restricting-your-api-key) Restricting your api-key ----------------------------------------------------------- 1) The Firebase generated API-KEY will be identified as being "auto created by Firebase". Click on the key, to open it's settings. 2) On the "Key restrictions" settings, choose the "Websites" option. 3) Finally, enter the URLs or domains you'd like to allow your credentials to be used and hit "Save". You can leave "API restrictions" as it is, with "Don't restrict key" checked. Important! You must also allow the domains on your Firebase Authentication Settings for features like Google/Facebook/Github login to work properly. For instance, "yourfirebaseappid.firebaseapp.com". Done! Your api-key is now secure. [https://console.cloud.google.com/apis/credentials?project=YOUR\_APP\_ID\_HEREconsole.cloud.google.com](https://console.cloud.google.com/apis/credentials?project=YOUR_APP_ID_HERE) Change the YOUR\_APP\_ID\_HERE text to your Firebase APP ID. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FTD4eKtwVThfEFTta14uc%252Fimage.png%3Falt%3Dmedia%26token%3Df073c3bc-26fa-4238-b5b0-c03fc4e94536&width=768&dpr=4&quality=100&sign=621bb53c&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F8hdfYXWvuibuZmEJJFBM%252Fimage.png%3Falt%3Dmedia%26token%3Dfe7c0fc7-ceac-434f-86fc-621b8a098eed&width=768&dpr=4&quality=100&sign=17f881a9&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F84sxGEjrHu9GBpqkzl4v%252Fimage.png%3Falt%3Dmedia%26token%3Dc1c85e14-bd76-4942-97bd-43f32a45347f&width=768&dpr=4&quality=100&sign=d3228c37&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FdGbLT5YfISVUkOfnkCAC%252Fimage.png%3Falt%3Dmedia%26token%3D3aea09de-99ec-4445-8523-fb2636590d2b&width=768&dpr=4&quality=100&sign=97eb6c4b&sv=2) --- # Firebase Auth (Current User) | Firebase Auth, Firestore & Storage (plugin) [PreviousData Schemas](/firebase-auth-firestore-and-storage-plugin/plugin-elements/data-schemas) [NextFirestore Data List](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) Last updated 10 months ago The Firebase Auth element was created to work as a substitute to Bubble's "Current User" value. So you can use to retrieve data and the authentication state from the user logged in through Firebase. * * * [](#settings) Settings --------------------------- ### [](#users-collection-name) Users Collection Name Here you must specify the id (or name) of the collection of document in Firestore where you chose to store user data. The plugin will fetch data from the document in that collection that has the same ID as the current authenticated user. ### [](#fields) Fields The names of the fields on the user's collection that you which to fetch from the document an use on Bubble. You can you "dot notation" to dive into the JSON structure of a Map field in a document (e.g. address.street to get the "street" property of the "address" field, if it is a Map type) ### [](#field-types) Field Types For each field you choose to fetch from the document, you must specify the type of data Bubble should try to receive. In some cases, more than one type can be applied, like in boolean values, that you can get as "text" or "yes/no". In other cases you must be careful to declare the right value, or error can occur, like when you try to declare a "number" for a "text" value. * * * [](#states-and-values) States and Values --------------------------------------------- The Auth element provides information on the authenticated user. Some are directly linked to the user, but some can be stored on the user's collection at Firestore. If the user is logged out, those states will be empty, so that is one the ways you can identify if the user is logged in (e.g. **Auth's user ID is not empty**). ### [](#user-id) User ID The ID of the authenticated user, that is also the ID of the same user's document on the users collection at Firestore. ### [](#user-email) User Email The email associated to the user's account. It can be empty if the user was created with SMS/phone login through another service, like FlutterFlow, for instance. ### [](#user-photo-url) User Photo URL The URL to the profile picture of the user. ### [](#user-display-name) User Display Name The user's display name associated with the account. ### [](#fields-1-2-3) Fields (1, 2, 3...) The fields of the user's collection on Firestore, that you chose to retrieve when you specified them on the Auth element settings. ### [](#user-document) User Document This state provides the whole JSON string of the document. This might be useful if you want to use a [Firebase Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) do get more fields from the user and the current element didn't have enough slots to do so. It can also be useful to provide document data to a popup filter, reusable element, et cetera, without the need to query the user's document again from Firestore. ### [](#auth-provider) Auth Provider The type of authentication of the current user. Can be password, google, facebook or github. ### [](#email-verified) Email Verified Indicates if the current user has verified his/her account's email. ### [](#created-at) Created At The date and time when the user has signed up. ### [](#last-login-at) Last Login At The date and time when the user last logged in to the app. ### [](#access-token) Access Token The current user's access token, that can be used to make authenticated calls to REST APIs. ### [](#refresh-token) Refresh Token The current user's refresh token, that can be used to acquire new access tokens. ### [](#data-is-ready) Data is Ready Turns to "yes" when all the element's states are done being filled, an "no" when they are being filled. Although this operations are fast, the fact the they are filled in order and not at the same time may lead to issues, that's why this state was created. * * * [](#element-actions) Element Actions ----------------------------------------- ### [](#refresh-a-firebase-auth-current-user) Refresh a Firebase Auth (Current User) This action will reload the elements data, which can be useful if, for any reason when you updated the user's credentials the profile information contained in the Auth Element is not refreshed automatically. * * * [](#events) Events ----------------------- The Auth element implement a function in the page that listens to any changes on the user's authentication state. This changes will trigger two different kinds of events that can initiate Bubble workflows: "User is logged in" and "User is logged out". ### [](#user-is-logged-in) User is logged in Triggered when the authentication state of the user is changed and the user is logged in. ### [](#user-is-logged-out) User is logged out Triggered when the authentication state of the user is changed and the user is logged out or null. This you also be triggered when a user's account is deleted. Important! If you use the "User is logged in" and "User is logged out" events to redirect users to another page, while creating an account, it is possible the the events will trigger before the write operations of firestore are completed during sign up. Because of that, it is suggested to use the "Firebase Action Listener" "User signed up" event for this case instead. ### [](#data-ready-or-changed) Data ready or changed Triggered when the user data is done loading from the authentication service and from Firestore. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FGzoF4m4MYHYaBYqOGo1N%252Fimage.png%3Falt%3Dmedia%26token%3D3024e256-966f-44c7-a985-b9ee1e1e8ea5&width=768&dpr=4&quality=100&sign=6e5ff163&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fmiwm3NfHKdxgXIRRekJr%252Fimage.png%3Falt%3Dmedia%26token%3Dba9e7800-1eaf-4aea-944d-f6545cf96c05&width=768&dpr=4&quality=100&sign=3fe8b366&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FIqIwuoAzAyuOygMpzJiQ%252Fimage.png%3Falt%3Dmedia%26token%3Df2cdc70b-92bf-4987-b950-ff51e45a35e4&width=768&dpr=4&quality=100&sign=bf0fb801&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FWv5za8ferdivQztya2Wl%252Fimage.png%3Falt%3Dmedia%26token%3D3a1d9566-22e2-4fc2-8f1b-a847f1eee8eb&width=768&dpr=4&quality=100&sign=d9c2cdbf&sv=2) --- # Firestore Data (legacy) | Firebase Auth, Firestore & Storage (plugin) [PreviousFirebase Geohash](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firebase-geohash) [NextFirestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) Last updated 10 months ago This element is decrecated an it is kept on the plugin for backwards compatibility purpose. We suggest using the new [Firestore Data List](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) element for a better experience and since this one might be eventually removed from the plugin in future versions. The Firestore Data element can be used to fetch document data from Firestore as a list, single document\* or a count\*\*. \*You can also use the Firestore Data Single element to fetch data from a single document \*\*You can also use the [Firestore Data Aggregation](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-aggregation) element to get the count, sum or average of document's fields in a list * * * [](#settings) Settings --------------------------- ### [](#firestore-collection) Firestore Collection Here you must specify the id (or name) of the collection you want to query data from. You can subcollections paths to choose a subcollection (e.g. collection/doc\_id/subcollection). The plugin will query data from the Firestore, running front-end process on Bubble. That way, no Workload units will be consumed. πŸ™‚ ### [](#query-type) Query Type * **List** Performs a query for a list of documents from the Firestore Collection you've specified. It also applies the query and front-end filters defined on the element's settings. * **Single** Performs a single document query from Firestore, in the collection and document id you specified. Filters won't be applied to single document queries. * **Count** Performs a document count query from Firestore, respecting the query filters you defined. Obs.: Each 1000 blocks of document accounted for will be billed as 1 document read on Firestore (e.g. 1500 documents counted will be billed for 2 reads). * **List and Count** Performs both List and Count queries. That way you can use the "(list) documents data" and "(count) number of documents" state at once. ### [](#doc-id-single) doc id (single) The ID of the document you want to get from Firestore. This setting is required for single type queries and will be ignored on List and Count queries. ### [](#make-query-static) Make query static If checked, document data won't update dynamically. If left unchecked, documents on List and Single queries will update responding to changes on the backend. Each document updated or removed from a list will account for a document read of Firebase's billing. Count queries won't be dynamically updated. You'll have to run the [(count) update number of documents at a Firestore Data](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firestore-data-legacy#count-update-number-of-documents-at-a-firestore-data) action to update the count state. ### [](#query-sort-order-by-options-list) Query sort / order by options (list) This option only works with queries of type "List" or "List and Count". You can choose a field to order your list of document from, at query level, specifying the sort direction (descending = yes | ascending = no). When doing a sorted query for the first time, you might be confronted with an alert asking you to create an index for that query. That's a Firestore feature that creates different indexes for the database, which makes queries lighting fast. To configure the new index, you need only access the link provided on the browser's console (press F12). After a couple of minutes, refresh the page and the query should work. ### [](#pagination) Pagination On the query sorting options, you can also specify a "Page Size" for the query, which allows you to work with pagination and can help you save document reads. When you define a page size of 8, for instance, the query will only get the first 8 occurrences of the query you configured. That's why this option works only when you have a defined order for the data. To change pages on the list, you can you the actions: * (list) show next page at a Firestore Data * (list) show previous page at a Firestore Data Pagination on dynamic queries that on which the order of document's changes a lot may lead to unwanted behaviors, such as documents disappearing and returning only after you reload the page or the Firestore Data element. That's because of how pagination works on Firestore, as it uses other document's as reference for each page. For instance, it you have 8 documents and one of them updates to the 9th position, since the next page starts at the current 10th document, this updated document might stay on a "limbo" in which it won't show unless you refresh the page or the Firestore Data element. This only happens if you had already loaded the 2nd page. ### [](#query-filters-list-count) Query filters (list) (count) This settings work only with queries of type "List", "Count" or "List and Count". This options allow you to choose fields from which to filter your query. If you have security rules set to allow only the "owner" of a document to see it, for instance, you'll need to add a query filter to get only document's where the field "owner" equals the current user's reference. You can choose to ignore empty constraints, which will simple "skip" the filter if the input you provided is empty. Keep in mind that in some cases this may require Firestore to create indexes for each filtering configuration. #### [](#available-query-operators) Available query operators You can read more on the [Cloud Firestore documentation](https://firebase.google.com/docs/firestore/query-data/queries#query_operators) . Operator Description < Gets values less than the provided input (must be of type number or date) <= Gets values less than or equal to the provided input (must be of type number or date) \== Gets values equal to the provided input. \> Gets values greater than the provided input (must be of type number or date). \>= Gets values greater than or equal to the provided input (must be of type number or date). array-contains Gets values where the field of type array/list has the value provided as input. array-contains-any Gets values where the field of type array/list any of the array of values provided as input. in Gets values where the field value is present on the array of values provided as input. not-in Gets values where the field value is not present on the array of values provided as input. Firestore supports only one filter of type "array-contains", "array-contains-any", "in" or "not-in" per query. If you try to use more than one, the first one will be considered by the plugin, but the other's will be ignored. Firestore does not offer "text" filters like the Bubble "contains keywords" option, because of the way they structure the database using indexes. For this kind os searches they recomend the use of external services like [Algolia](https://www.algolia.com/) . #### [](#types-of-filter-values) Types of filter values Since Bubble is not flexible on the type of data we can define on plugins, the best way to implement our plugin was to work with texts. So each value you put on query values must be interpreted the right way to perform the Firestore Query. Defining a "query filter value type" can help us get it right. So here are the types of query filter values: Type How it will be handled auto The plugin will try to infer the type from the input you provided. text Treated as a text value. number Treated as a number value. boolean (true/false) Treated as a true or false (yes/no) value. date Treated as a Date type. The plugin will convert the value to a Date. array Treated as a list in JavaScript format (e.g. \["item1", "item2", "item3"\]). If you need to use it on Bubble's lists, you can apply the ":format as text" message to the list, to build the array string into that format. reference (coll/doc\_id) Treated as a document reference. Document references are always handled by the plugin as paths to a document. For instance, if you want to get the reference for a document from the "tasks" collection with an id "1234", you should right "tasks/1234" Arrays and lists are always handled in JavaScript notation, which means each value should be comma separated and must be between brackets. An array of number should be provided as a text like: \[1, 3, 45, 2\] An array of texts should contain balues between quotes: \["text1", "text2", "text3"\] Document references are always handled by the plugin as paths to a document. For instance, if you want to get the reference for a document from the "tasks" collection with an id "1234", you should right "tasks/1234" ### [](#front-end-sort-lists) Front-end sort (lists) Once data is fetched from Firestore, the plugin allows you to perform front-end operations without the need to query data again. This is ideal for performing fast sorting or filters as a reaction from input value changed on the user's UI. To sort data, you must specify the name of the field, it's type and the direction (descending = yes | ascending = no). In most cases, you'll want to make the sort field be the same from the ["query sort" field](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firestore-data-legacy#query-sort-order-by-options-list) . ### [](#front-end-filters-lists) Front-end filters (lists) Comparison / Operator Description \== Gets values equal to the provided input. <> Gets values not equal to the provided input. \>= Gets values greater than or equal to the provided input (must be of type number or date). \> Gets values greater than the provided input (must be of type number or date). <= Gets values less than or equal to the provided input (must be of type number or date) < Gets values less than the provided input (must be of type number or date) contains Gets values where the field of type array/list has the value provided as input. contains-any Gets values where the field of type array/list has any of the array of values provided as input. contains case sensitive Gets values where the field of type array/list has the value provided as input, but differentiating uppercase from lowercase characters. doesn't contain Gets values where the field of type array/list doesn't have the value provided as input. doesn't contain case sensitive Gets values where the field of type array/list doesn't have the value provided as input, but differentiating from uppercase and lowercase characters. is in Gets values where the field value is present on the array of values provided as input. isn't in Gets values where the field value is not present on the array of values provided as input. isn't empty / count > 0 Gets values where the field value doesn't exist, is empty or, if it's an array/list, its length is zero. is empty / count = 0 Gets values where the field value exists, is not empty or, if it's an array/list, its length is greater than zero. ### [](#extract-fields-from-a-list-of-documents) Extract fields from a list of documents You can provide the names of the fields on the list of document's you'd like to get as a list on Bubble. You can you "dot notation" to dive into the JSON structure of a Map field in a document (e.g. address.street to get the "street" property of the "address" field, if it is a Map type) #### [](#field-types) Field types For each field you choose to fetch from the document, you must specify the type of data Bubble should try to receive. In some cases, more than one type can be applied, like in boolean values, that you can get as "text" or "yes/no". In other cases you must be careful to declare the right value, or error can occur, like when you try to declare a "number" for a "text" value. #### [](#get-list-inside-field) Get list inside field This option allows you to merge fields of type list in one single list. For instance, if you have two documents with a field named "tags", that has a list of texts (one \["tag1"\] and the other \["tag1", "tag2\]), this option will merge them as \["tag1", "tag1", "tag2"\] instead of bringing two array values as texts (i.e. \["tag1"\], \["tag1", "tag2"\]). #### [](#ignore-filters) Ignore filters This option will make the list of values ignore the front-end filters applied to them. This is useful when you want to use this list to feed the choices source of a Dropdown or input that you want to use as a front-end filter. If you leave this option unchecked, the choices sorce would be filtered too. * * * [](#states-and-values) States and Values --------------------------------------------- The Firestore Data element provides states according to the query type you chose on it's settings. ### [](#document-data-single) Document data (single) The document JSON string, that can be provided to a [Firestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) to get the values from the document fields. ### [](#documents-data-list) Documents data (list) A list of document JSON strings, that can be provided to repeating groups and then, on each cell, extracted through a [Firestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) to get the values from the document fields. ### [](#collection) Collection The name of the collection from which the element is getting it's data from. ### [](#error-message) Error message If the query fails and returns an error, the error message will be stored on this state. ### [](#documents-ids-list) Documents ids (list) A list of texts contains the IDs of the document fetched from a "List" or "List and Count" type of queries. ### [](#fields-lists-1-2-3) Fields Lists (1, 2, 3...) Lists of fields you chose to retrieve from the documents list, with filters already applied. ### [](#data-is-ready) Data is Ready Turns to "yes" when all the element's states are done being filled, an "no" when they are being filled. Although this operations are fast, the fact the they are filled in order and not at the same time may lead to issues, that's why this state was created. * * * [](#element-actions) Element Actions ----------------------------------------- ### [](#refresh-list) Refresh (list) This action reloads the elements data, performing queries again. This might be useful to provide consistency in your data. ### [](#update-number-of-documents-count) Update number of documents (count) This action allows you to add, remove or refresh the count query of a Firestore Data element. Tip: Sometimes you now exactly how the count will change, like when a user adds a new task to his/her list, you know it will increment in 1, so you don't need to perform the query again, saving some document reads. ### [](#update-a-document-entry-static) Update a document entry (static) On static queries, though we don't need to have them listen for changes all the time, updating a single document on it might be needed sometimes. Because of that we provide this update action for you to specify a document id that will be fetched again from Firestore and will substitute the current entry on the static query. That helps to avoid an enteire refresh of the query, saving document reads and fetching a single document instead of a list. ### [](#show-next-page-list) Show next page (list) When you have a defined page size, this action queries the next set of documents of the query, according to the page size you set, displaying them on the ["document data" state](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firestore-data-legacy#document-data-single) . ### [](#show-previous-page-list) Show previous page (list) When you have a defined page size, this action get the previous set of documents of the query. This won't make another query. Since the document were already available on the front-end, the plugin stores them to display them again as needed. If you which to update any entry on the document list already fetched, you can use the [update document entry](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firestore-data-legacy#update-a-document-entry-static) action. * * * [](#events) Events ----------------------- ### [](#data-ready-or-changed) Data ready or changed This event is triggered when the data from the query is ready, or when new data arrives in a dynamic query. Each document updated in a dynamic query accounts trigges the event, so if you have, for instance, 3 quick updates, the event will be triggeres 3 times. * * * [](#using-query-results-as-inputs-in-other-queries) Using query results as inputs in other queries ------------------------------------------------------------------------------------------------------- Keep in mind that, bacause the query operations run on the front-end, Bubble sometimes messes with the order in which data arrives from Firestore. That means you must account that factor while using results of other Firebase elements as input data in other query elements. For instance, if you want to get documents form the "tasks" collection where the "owner" filter equals the current user's document reference, you can use the filter bellow (owner == users/Firebase Auth's User ID). But if the User ID is not yet available, the query will fail due to security rules on Firestore. To work around that, you can put a visibility conditional on the Firestore Data element, for it to show only when the User ID is not empty. As the query will only occur when the element is "visible" on the page, it will wait for when the User ID is available to run the query, avoiding the error. Keep that in mind when fetching data from Firestore. Access the provided link to create the new index for the query. Query filter operators Query filter value types Front-end filter types Count update options. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FNs6ohcAja9uY38VGjKym%252Fimage.png%3Falt%3Dmedia%26token%3D9902cd7e-b38a-4b4b-ba7e-22971e5cc10a&width=768&dpr=4&quality=100&sign=be9bba71&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FUFe1bsA7dhKAkBC0cD55%252Fimage.png%3Falt%3Dmedia%26token%3Df8b3c54d-680f-4163-9821-06efcb0cca92&width=768&dpr=4&quality=100&sign=a7ecc6c5&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FjD8cUhI9e4rk54UlpWce%252Fimage.png%3Falt%3Dmedia%26token%3Df0a80144-bec9-4355-8e34-6153a571b59b&width=768&dpr=4&quality=100&sign=8882fd21&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F2js8kW3EGArtakDREL7B%252Fimage.png%3Falt%3Dmedia%26token%3D44387ac3-3e49-439d-996f-37c4227f9645&width=768&dpr=4&quality=100&sign=70ce2342&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FZzduHWvShdP2FWiBBVEB%252Fimage.png%3Falt%3Dmedia%26token%3D3a6b00e0-85b3-4281-82a9-f9e9022dc45c&width=768&dpr=4&quality=100&sign=54ce8f35&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FgSrSn4QTUtXVZvfe8i3f%252Fimage.png%3Falt%3Dmedia%26token%3Da1396fe3-bcce-4c81-952d-3f72882056de&width=768&dpr=4&quality=100&sign=365d42ee&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F7q3Il0tiGAcoReaykxJL%252Fimage.png%3Falt%3Dmedia%26token%3D5080dfda-a696-4abe-a680-173cfd0dc7ec&width=768&dpr=4&quality=100&sign=ad08d7a9&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fy2R7y7rIM0C0hHqAjXPe%252Fimage.png%3Falt%3Dmedia%26token%3D732a53cb-b98a-4c9b-a55f-2d8109599c86&width=768&dpr=4&quality=100&sign=7fddb08c&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FAShWdu4f4G7ij1Xz0zaj%252Fimage.png%3Falt%3Dmedia%26token%3Db9be8274-209b-4991-9117-313ecc6cf266&width=768&dpr=4&quality=100&sign=ccfad4ce&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FX9rF8ZBFkyg13zihlSqf%252Fimage.png%3Falt%3Dmedia%26token%3D0032d2cd-a945-4200-8179-1bc313431f71&width=768&dpr=4&quality=100&sign=7eaa984f&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FNUpxKSJcupzU6L0NyEHc%252Fimage.png%3Falt%3Dmedia%26token%3Daab38352-0efb-4c67-bc2d-87fa9bbe28e9&width=768&dpr=4&quality=100&sign=be8741b1&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FP9va6Lbvr4XYaEVGE7PV%252Fimage.png%3Falt%3Dmedia%26token%3D555006ac-f08e-4319-b6dc-c68610975aa6&width=768&dpr=4&quality=100&sign=80a6ea30&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FZxpueCsLbXs0JysEqvV1%252Fimage.png%3Falt%3Dmedia%26token%3D1703b896-60fd-4044-8320-4e4b9172d839&width=768&dpr=4&quality=100&sign=7dbd1774&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FQqkjYC0ln1DSdNVuMAab%252Fimage.png%3Falt%3Dmedia%26token%3D52d0eadc-f0c9-4c04-bcfb-d3448d97c0ac&width=768&dpr=4&quality=100&sign=7cfaecfc&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FDhCKM9jHU71jOvy8a7aO%252Fimage.png%3Falt%3Dmedia%26token%3D0e126d1b-a615-4a68-a036-8059d25e4b13&width=768&dpr=4&quality=100&sign=6580d229&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F4dwcCw2iK6ODbHeNXqeL%252Fimage.png%3Falt%3Dmedia%26token%3D7cf84483-7f7c-4350-8fa2-1fc9d9974a22&width=768&dpr=4&quality=100&sign=ab3022c1&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FYCCZrRd4RniMElq0dE1j%252Fimage.png%3Falt%3Dmedia%26token%3D6db6785a-7940-4ac8-8290-78f1385cf008&width=768&dpr=4&quality=100&sign=8cabc405&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F64ndk7wyjgZpJ3f3cbxj%252Fimage.png%3Falt%3Dmedia%26token%3D263f56c2-2b7c-4ac0-8b6b-a21a266c90e3&width=768&dpr=4&quality=100&sign=d5145639&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FSE3Uvl3dMWihfpj81wC8%252Fimage.png%3Falt%3Dmedia%26token%3Dae266481-348c-4cb4-9523-750877344a59&width=768&dpr=4&quality=100&sign=885ec2cd&sv=2) --- # Firebase Geohash | Firebase Auth, Firestore & Storage (plugin) [PreviousFirestore Data List](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) [NextFirestore Data (legacy)](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list/firestore-data-legacy) Last updated 1 year ago An element that generates a geohash text/string from a give Latitude and Longitude. * * * [](#settings) Settings --------------------------- ### [](#latitude) Latitude Here you must specify the id (or name) of the collection of document in Firestore where you chose to store user data. The plugin will fetch data from the document in that collection that has the same ID as the current authenticated user. ### [](#longitude) Longitude The name or path (in dot notation) of the field you want to extract from the document. [](#states-and-values) States and Values --------------------------------------------- ### [](#geohash) Geohash The resulting geohash. ### [](#latlng) LatLng A string the joins the latitude and longitude comma separated. For instance: \-19.932022624797003,-43.9380429331808 This value can be used as an input on actions like [Create a new document](/firebase-auth-firestore-and-storage-plugin/plugin-front-end-actions/firestore/create-a-new-document) , in field of type Geopoint. ### [](#latitude-1) Latitude A copy of the latitude provided on the input field of this element. ### [](#longitude-1) Longitude A copy of the longitude provided on the input field of this element. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fybjv9RWySonmnsv1slDr%252Fimage.png%3Falt%3Dmedia%26token%3Da7f48c83-d12f-4afc-ad1c-3bb5e9a2f9f3&width=768&dpr=4&quality=100&sign=9312810&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FKVUAnS9eJaTvw2SqSfux%252Fimage.png%3Falt%3Dmedia%26token%3Dd8cf4187-e0d5-4332-8436-40044b1e9dee&width=768&dpr=4&quality=100&sign=2b561846&sv=2) --- # Data Schemas | Firebase Auth, Firestore & Storage (plugin) [PreviousAbout elements](/firebase-auth-firestore-and-storage-plugin/plugin-elements/about-elements) [NextFirebase Auth (Current User)](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-auth-current-user) Last updated 10 months ago From v4.4.0, we have added to the plugin the possibility of linking "data types" do documents read from a [Firestore Data List](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) , [Firestore Data Single](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-single) or [Firebase Auth (Current User)](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firebase-auth-current-user) elements. Since v4.5.0, [Firebase Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) and [Firebase Data Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-processor) elements also receive the "data schema" option. You can see a sample of the "task manager" app using data schema on this editor -> [https://bubble.io/page?type=page&name=tasks-with-schema&id=estare-plugin-firestore&tab=tabs-1](https://bubble.io/page?type=page&name=tasks-with-schema&id=estare-plugin-firestore&tab=tabs-1) That mean you can define a type of "thing" on [Bubble's API Connector](https://manual.bubble.io/core-resources/api/the-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) Here is how to do it --------------------------------------------------- 1. Install the Bubble API Connector on your Bubble app 1. Click on "Add another API" 1. Click on "Add another call" 2. 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". 1. Click on the "Manually enter API response" option 1. Get a sample, in JSON, of the Firestore document you want to create a schema to, and paste it on the popup window. You can you our "[schema builder](https://estare-plugin-firestore.bubbleapps.io/version-test/schema-builder) " to turn the raw JSON string returned by [Firestore Data Single](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-single) elements into a "data schema" you can you on the API Connector. 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) 1. Now, on one of the supported element, you can define the "data schema" as "task" 1. Then, you can access the document's fields from the "data (w/ schema)" state. πŸ’Ύ ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FNMmK2LGWn5eZbguf7tOj%252Fimage.png%3Falt%3Dmedia%26token%3D953c0889-b915-444d-a55d-0978769538a3&width=768&dpr=4&quality=100&sign=e85b5bbd&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FyUxEJ65hU73btaEbkvQp%252Fimage.png%3Falt%3Dmedia%26token%3D5207bbb9-edc8-4d73-8dff-34f94066959b&width=768&dpr=4&quality=100&sign=94c3ad80&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Ffm2NisfbshHtzzOzjZnc%252Fimage.png%3Falt%3Dmedia%26token%3D2707d358-3db8-4477-97fa-27aa2270fe3e&width=768&dpr=4&quality=100&sign=4a5e9718&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FpIWSMU8ZujrX0q7nqtfq%252Fimage.png%3Falt%3Dmedia%26token%3D208c39f3-a907-4fe4-89d7-4136d929a833&width=768&dpr=4&quality=100&sign=eed3beb6&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FE6vOGlH2Ki94guwZ51cw%252Fimage.png%3Falt%3Dmedia%26token%3D4f79dfbf-8026-4749-b267-2d66546f7332&width=768&dpr=4&quality=100&sign=da8cfd3d&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FUZMWiRNOsDkvbB45o01d%252Fimage.png%3Falt%3Dmedia%26token%3Dc52171ad-585d-4611-a535-8e05c09c4de7&width=768&dpr=4&quality=100&sign=43a564d2&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FiYMumRw9NOI5qGER9kMX%252Fimage.png%3Falt%3Dmedia%26token%3D61e83ed7-a10e-445a-b69d-47021e0aeaef&width=768&dpr=4&quality=100&sign=41b7b4d&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FSqpfC4FmtxaXfOz0UTnn%252Fimage.png%3Falt%3Dmedia%26token%3Ddff6b5eb-a350-418e-8cad-c974443e5b6a&width=768&dpr=4&quality=100&sign=e4f48172&sv=2) --- # Firestore Data Single | Firebase Auth, Firestore & Storage (plugin) [PreviousFirestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) [NextFirestore Data Aggregation](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-aggregation) Last updated 10 months ago The Firestore Data Single element combines the behavior of the [Firestore Data](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) and [Firestore Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) elements. As it is very common to get a single document from the database, instead of using a Data Element + Extractor Element to get the document's fields, you can simply use the Firestore Data Single. * * * [](#settings) Settings --------------------------- ### [](#firestore-collection) Firestore Collection Here you must specify the id (or name) of the collection you want to query data from. You can subcollections paths to choose a subcollection (e.g. collection/doc\_id/subcollection). The plugin will query data from the Firestore, running front-end process on Bubble. That way, no Workload units will be consumed. πŸ™‚ ### [](#doc-id) Doc ID The ID of the document you want to get from Firestore. ### [](#make-query-static) Make query static If checked, document data won't update dynamically or react to changes on the database. ### [](#fields-1-2-3) Fields (1, 2, 3, ...) The name or path (in dot notation) of the field you want to extract from the document. For instance, if you you want to extract the content of the field "description" on the document, that's the name you should put on this setting. If the field is of type Map, you can use "dot notation" to extract the value of a specific key on the map. In the example below, a field of name "links" has two keys, "pt-br" and "en-us". To get the value from the "pt-br", the Field would be "links.pt-br". If you don't specify a path and only provide "links" as a path, the entire Map JSON structure can be used as a text. This JSON text can be used in another Data Extractor to get specific fields from it too. ### [](#field-list-1-2-3) Field List (1, 2, 3, ...) The name of the array/list field you want to extract from the document. The generated state will be turned into a Bubble list of values. If the list is a list of "Map" types, you can feed them to a [Firestore Data Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-processor) , to treat them as a list of documents and extract data further. ### [](#field-types-1-2-3) Field Types (1, 2, 3, ...) Choose between the Bubble's basic data types, so that the value of the Field you're extracting can be translated to it. This can end up in error's, like if you try to provide a text to a field you defined as number, so be careful with what you choose and check your browser's console (press "F12") to look for errors. Some data types on Firestore must be treated as texts on Bubble if you want to display them or use them elsewhere, like "Maps" or "References". "Reference" types will be displayed as a text showing the path to the document, like so: collection\_name/document\_id (e.g. tasks/6KXLqGVsvGdytOI5pB8F or users/6n6tlWXTDwUp3f7yQ95mpITUUmZ2) * * * [](#states-and-values) States and Values --------------------------------------------- The Firestore Data Single element provides similar states to those from the [Data](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-list) and [Data Extractor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor) elements. For each field you get from the document, there is a corresponding state containing it's value, along with some other useful data. ### [](#data) Data The JSON structure of the document. It can be used in a Firestore Data Extractor element, to get more fields than those available on this element. Or you could use it to pass along the document data to another element or page in your application. Keep in mind that this document data is not dynamic, which means that if you pass it to another element or a Custom State, for instance, this data won't react to changes in the database, even if they come from a dynamic query. ### [](#data-w-schema) Data (w/ schema) The JSON data, interpreted through the "data schema" you define on an API Connector and provide to the element. See how to configure this on the [Data Schemas](/firebase-auth-firestore-and-storage-plugin/plugin-elements/data-schemas) documentation. ### [](#document-id) Document ID The ID of the processed document. This ID is available in the JSON structure under the key "\_id", but is extracted by default. ### [](#collection) Collection The collection of the processed document. ### [](#error-message) Error message Stores the last error message on the element, if there was any. ### [](#field-1-2-3) Field (1, 2, 3, ...) The value extracted from the field, translated to the Field Type you defined for it. ### [](#field-list-1-2-3-1) Field List (1, 2, 3, ...) A list of values extracted from an array field on the document, each entry translated to the Field Type you defined for it. ### [](#data-is-ready) Data is Ready Turns to "yes" when all the element's states are done being filled, an "no" when they are being filled. Although this operations are fast, the fact the they are filled in order and not at the same time may lead to issues, that's why this state was created. * * * [](#events) Events ----------------------- ### [](#data-ready-or-changed) Data ready or changed This event is triggered when the document is ready or any changes come from the database. * * * [](#using-query-results-as-inputs-in-other-queries) Using query results as inputs in other queries ------------------------------------------------------------------------------------------------------- Keep in mind that, bacause the query operations run on the front-end, Bubble sometimes messes with the order in which data arrives from Firestore. That means you must account that factor while using results of other Firebase elements as input data in other query elements. For instance, if you want to get documents form the "tasks" collection where the "owner" filter equals the current user's document reference, you can use the filter bellow (owner == users/Firebase Auth's User ID). But if the User ID is not yet available, the query will fail due to security rules on Firestore. To work around that, you can put a visibility conditional on the Firestore Data element, for it to show only when the User ID is not empty. As the query will only occur when the element is "visible" on the page, it will wait for when the User ID is available to run the query, avoiding the error. Keep that in mind when fetching data from Firestore. ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FB0S9d14WUwNLoFi7BzWh%252Fimage.png%3Falt%3Dmedia%26token%3Dfe450a34-876e-44c2-be7b-267ad6993492&width=768&dpr=4&quality=100&sign=9948ee18&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fr8AKNEt6xMEN3bxVHVnC%252Fimage.png%3Falt%3Dmedia%26token%3D5368ce40-321a-4771-ae1c-e12b9d92ed30&width=768&dpr=4&quality=100&sign=7a411498&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FhLG2Lnt9a2jvHVnzV8XE%252Fimage.png%3Falt%3Dmedia%26token%3De1b248eb-f087-4d75-936b-f95dcd2f1009&width=768&dpr=4&quality=100&sign=b03809a&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FQ0X2ibyVg0zWHaJmFoZh%252Fimage.png%3Falt%3Dmedia%26token%3D55c7435a-103b-4581-be2c-fde8a9657da8&width=768&dpr=4&quality=100&sign=a3847c48&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FuFwZpDfEy17YpIwC1Q85%252Fimage.png%3Falt%3Dmedia%26token%3D8a7747dc-cbc2-457a-9a74-ee2e31aeaff1&width=768&dpr=4&quality=100&sign=65ea7512&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FWNaEeNKf1jRVLAIDYVmP%252Fimage.png%3Falt%3Dmedia%26token%3D25c4038f-a82f-4145-a5e6-38fa8d40e366&width=768&dpr=4&quality=100&sign=f5e939ca&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FPvMZghF6GzD4ahM2fGHy%252Fimage.png%3Falt%3Dmedia%26token%3Dc6c6d751-7281-49dd-972a-eaf6709e0f9a&width=768&dpr=4&quality=100&sign=a5946526&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FcNWtJTtWrCvviWvzhghS%252Fimage.png%3Falt%3Dmedia%26token%3Dbba356af-d672-4145-a84d-81ec89378de2&width=768&dpr=4&quality=100&sign=661019a6&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F2q3eYaDtWfOaIcws6BMY%252Fimage.png%3Falt%3Dmedia%26token%3Db3540edf-6857-4dfb-a582-2db6c2d71d59&width=768&dpr=4&quality=100&sign=467fedef&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FsgONplJnBiT0Ko2Y176C%252Fimage.png%3Falt%3Dmedia%26token%3Dc5879cff-c7aa-42ee-9a74-a99a2fac4dfd&width=768&dpr=4&quality=100&sign=17f96d7b&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FRXE6tnZgkPVPQb1ILWLP%252Fimage.png%3Falt%3Dmedia%26token%3D866727f3-4a2b-4ce5-95ff-c85e9150c56b&width=768&dpr=4&quality=100&sign=42b0c875&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FqzvkWQ3Qx8fkpeUP526d%252Fimage.png%3Falt%3Dmedia%26token%3D1efa8353-ffae-4179-9fbb-2d8249912b2a&width=768&dpr=4&quality=100&sign=a3af36b7&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FRPnbduDUhsB5ZpMQwu38%252Fimage.png%3Falt%3Dmedia%26token%3D948a45dc-dd3c-4bb8-ba0f-8588528a8a42&width=768&dpr=4&quality=100&sign=f1df5727&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252Fc8gjEQsqY3zv1eoyrz1r%252Fimage.png%3Falt%3Dmedia%26token%3D73044ef0-e587-489e-97fc-07fff6a790b1&width=768&dpr=4&quality=100&sign=8a5ea7c4&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FYCCZrRd4RniMElq0dE1j%252Fimage.png%3Falt%3Dmedia%26token%3D6db6785a-7940-4ac8-8290-78f1385cf008&width=768&dpr=4&quality=100&sign=8cabc405&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252F64ndk7wyjgZpJ3f3cbxj%252Fimage.png%3Falt%3Dmedia%26token%3D263f56c2-2b7c-4ac0-8b6b-a21a266c90e3&width=768&dpr=4&quality=100&sign=d5145639&sv=2) ![](https://estare.gitbook.io/~gitbook/image?url=https%3A%2F%2F284736847-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FiWu3FezEjWxrPbkf8zIP%252Fuploads%252FSE3Uvl3dMWihfpj81wC8%252Fimage.png%3Falt%3Dmedia%26token%3Dae266481-348c-4cb4-9523-750877344a59&width=768&dpr=4&quality=100&sign=885ec2cd&sv=2) ---