Creating & Updating Firestore Documents

Creating or updating documents in your Firestore collection requires that you have two types of components on your screen:

  • A component with a Field Name prop to log user input. The list of these components can be found here.
  • A Button or Touchable component to submit the data the user inputs.

On the Button/Touchable you want to use to submit the user inputs, navigate to the "Interactions" tab in the right-hand panel and click the "+" to add an Action. In the drop down, select "Firebase Request."

Creating Documents

Inside the Firebase Request "Setup" config, select "Request" and within that dropdown, select "Create Document."

You can also add a name for this request, but that is not required.

Then navigate to Firebase Request "Configurations" section and select the collection and the ID of the document you want to create.

Finally, in the "Fields To Update" section of your Firebase Request, you'll see the fields from your input components will display. You then need to map those input fields to the desired fields in your selected Firestore document, either by typing them in or selecting them in the dropdown.

Here's an example of a how to configure this using Text Input components and a Button to create a new document.

Updating Documents

Inside the Firebase Request "Setup" config, select "Request" and within that dropdown, select "Update Document."

You can also add a name for this request, but that is not required.

Then navigate to Firebase Request "Configurations" section and select the collection and the ID of the document you want to update.

Finally, in the "Fields To Update" section of your Firebase Request, you'll see the fields from your input components will display. You then need to map those input fields to the desired fields in your selected Firestore document, either by typing them in or selecting them in the dropdown.

Here's an example of a how to configure this using a Text Input component and a Button to update a document.


Did this page help you?