Save user data in Firebase

Save user data in Firebase (score, profile, language preference, progress...) and make user experience more personal in the app.

This feature relies on the authentication system via Firebase.

When a user account is created on Firebase, it has a fixed set of properties: a unique identifier an email address and a name that are stored in the Firebase project user database. Thanks to Cloud Firestore the Firebase database, you can store additional properties: a score, a user profile etc... 

💡 Before associating any data with a user, first create a Firebase project and configure it properly via the Firebase Session component. Insert the authentication form to allow users to log into your application. 

Data structure 

Cloud Firestore is a NoSQL cloud database that is used to add, retrieve and update data in your application. Basically, it is a database used to store data in your Firebase console. Firestore data is stored as documents, which are organized into  collections. There are no tables or rows. Each document contains a set of key value pairs.

The collection users contains your different users, each represented by a document.

Here is an example of a document: 

Cloud Firestore is schema-free, so you have complete freedom over the fields you place in each document and the types of data you store in those fields.

Create / edit data from the app

On Cloud Firestore there is no predefined data structure, it is up to you to structure your data according to your needs. Simply assign data to a document within a collection. If the structure is not known, Cloud Firestore will automatically create it.

Select a trigger and choose the action  Interact with a database> Session Firebase > Modify the data.

💡 Beware of typing errors: you must use the same name for this data wherever you use it.

To modify the data, choose from the available functions: 

Increment / Decrement

This function allows you to increment or decrement a data by a number. This data must also be of type Number. It allows you to manage a score: 

💡If your data is of type Text but represents a number, it is also possible to use this function.

Add

The function Add function is used to add a value to a data of type Table. This value can be of any type: String, Number etc.... 

In particular, it allows you to manage a selection by adding the identifier of a selected item: 

Delete by id 

Similar to the function Add, this function allows you to delete a value from a data item. It is mostly used for collections...

It works like the function By Id, that is, it returns the value of an element from its unique identifier.

In particular, it is used when you delete the identifier of a bookmarked element. 

Delete by value 

The function  Delete by value allows in a data type Table to delete a value.

Delete

The function  Delete allows you to delete the value of any data, regardless of its type.

Manage data from Console Cloud Firestore

From the Firebase console, view, add, edit and delete your data in real time.

Click on a collection to view its documents, then click on a document to view its fields and sub-collections. Click on a field to change its value 

You can reuse your data in an automation workflow  

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.