Twitter LogoFacebook Logo
Firestore - Update Document
Learning the design flow to update documents to Firestore in FBP
By: King

Hello, in this video, I’ll show you how to update documents in Firestore using the FBP Firebase Plugin for Unreal Engine.

To update a document in Firebase using the FBP Firebase Plugin

(1) First, create the document using a series of nodes provided by the plugin
(2) Update the document by using the “Update Document” node

Below is a sample workflow of updating a document.

Image from Codeible.com

Creating a Document

To begin creating the document, use the “Begin Write Document” node. 

Image from Codeible.com

Then, add data to it by calling these available nodes:

(1) Add String
(2) Add Number
(3) Add Boolean
(4) Add String Array
(5) Add Number Array
(6) Add Boolean Array
(7) Add Map

Updating the Document

Once the document is created, use the “Update Document” node and connect the Document object returned by the last add node to the Document pin.

For the Document Path, create a String array and set it into the Document Path pin. Every even element represents a collection, and every odd element represents a document.

The Path should point to a document reference in Firestore for the node to work.

In the sample below, it will update a document in the “users” collection.

Image from Codeible.com

Callback functions

The Add Document function has 2 callback pins used to handle events after the operation is completed.

When the Document is updated successfully, it will call the On Document Updated callback and when it fails, it will call the On Fail to Update Document callback.

Image from Codeible.com

To create these callbacks, click and hold on the callback pin from the node. Then drag and let go on an empty spot on the blueprint.

Select “Add Event” then “Add Custom Event.” That will create the event node fit for the callback.

Image from Codeible.com

Sign In