Cloud Firestore
Last updated
Last updated
© 2024 UI Bakery
Learn how to perform CRUDL operations with Cloud Firestore. Start with adding Cloud Firestore as your data source.
Open the project and create a new Action. Choose the Code action step and insert a code that will load your Firestore collection.
Then, press the Run Action button and open the Result section. You must have your collection's data loaded there.
To fetch data about a certain document, start with Creating a new Action and selecting the Code step.
Insert the code below to read the document's data:
Press the Run Action button and open the Result section. You will see the document's data.
Let's create a new record in Firestore. First of all, we need to create a new Action. Choose a Code action type and insert the code that will create a new record in your Firestore.
Press the Run Action button and open the Result section. You must have a new record there.
Let's delete a record from Cloud Firestore. Create a new action and select a Code action step. Type in a code:
Press the Run Action button and open the Result section to check that the record has been deleted.
You can update the data in Cloud Firestore with 2 methods: set()
and update()
. The difference is, set()
will overwrite the whole document.update()
will update only certain fields that need to be updated. Let's check both of the approaches for updating your Firestore data.
Create a new action and selecta Code action type. The code would be as follows:
set()
In case you do not want to overwrite your data, you can add merge: true
to your code, so that you only update the required fields
update()
For the update() method, type in the below Code:
Click Run Action and check the Result section for the outcome.
All the other operations with the Firestore collections like Filter, Order can be done via the Firestore API. You can find an API reference here.
More useful articles on how to further manage your data: