Firebase Query
The Firebase Query action allows you to execute multiple operations in Firestore, Realtime DB, and Firebase Auth services. In order to to execute the query you need to select the service, method, and define their parameters. You can use UI Bakery variables to compose keys in Realtime DB, collection names in Firestore queries, and so on.
Below you'll find more Firebase Query examples for all the services.
Working with Firestore
Getting collections list
To get a list of your collections, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Get collection list as the Firestore method and provide the Parent document ID or leave it blank for top level collections.

Querying Firestore
To query Firestore, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Query as the Firestore method and specify your collection name. You can filter your query by values, add limits, and add ordering by a certain field.

Getting a document by ID
To get a document by ID, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type.
Choose Get document by ID as the Firestore method and specify the collection name and document ID. Document ID can receive dynamic values passed in {{}}
.
Updating a document
To update a document, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type.
Choose Update document as the Firestore method. Specify the collection name, document ID and the objects that need to be updated. Document ID and values can receive dynamic values passed in {{}}
.

Inserting a document
To insert a document, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Insert document as the Firestore method. Since the pattern of document insert is the same as for updating a document, you can leave the document ID blank, and Firestore will generate it automatically.
Deleting a document
To delete a document, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type.
Choose Delete document as the Firestore method and only provide the document ID. Document ID can receive dynamic values passed in {{}}
.

Querying collection group
To query a collection group, you need to select your Firestore data source from the list of data sources and select the Firebase Query action type. Choose Query collection group as the Firestore method and specify your collection name. You can filter your query by values, add limits, and add ordering by a certain field.
Working with Firebase Auth
With UI Bakery, you can manage your users from the Firebase Auth setup, namely view, update, create new and delete existing users.
Listing users
To get a list of your users, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose List users as the Firebase Auth method. You can limit the number of returned users if necessary.
Getting user by UID/ email/ phone number
To get a certain user by their UID, phone number or email, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Get user by UID/ email/ phone number as the Firebase Auth method.
Creating a new user
To create a new user, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Create user as the Firebase Auth method and provide a user object.
Updating a user
To update user's information, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Update user as the Firebase Auth method and specify user's UID and the update object.
Deleting a user
To delete a user, you need to select your Firestore Auth data source from the list of data sources and select the Firebase Query action type. Choose Delete user as the Firebase Auth method and specify user's UID.
Working with Realtime DB
Querying the database
To query Realtime DB, you need to select your RealtimeDB data source from the list of data sources and select the Firebase Query action type. Choose Query as the Realtime database method and specify your database reference.
To enable additional filtering options, turn on the Use ordering toggle. The following filters are available:
Ordering by child, key, value, or priority
Ordering by limit (limit to first/ limit to last)
Filtering queries with
equalTo
,startAt
,endAt

Setting/updating data
In Firebase databases, you can use two approaches to updating data:
set
rewrites the current values of an itemupdate
updates the required values of an item, but doesn't rewrite all the values of an object
To use the set
method, select it from the action dropdown, specify the database ref and the data object.

To use the update
method, select it from the dropdown, specify the database ref and the data object.

Appending data to a list
To append data to a list, you need to select your RealtimeDB data source from the list of data sources and select the Firebase Query action type. Choose Append data to a list as the Realtime database method and specify your database ref and the data object.

Last updated
Was this helpful?