Skip to main content

Firebase Component

Create, read, update, and delete documents in a Firebase Cloud Firestore database collection.

Component key: firebase

Description#

Firebase is a platform developed by Google for creating mobile and web applications. Firebase Cloud Firestore is a document-based, flexible, scalable, and NoSQL cloud database, used to store and sync data for client and server-side applications. This component uses the Firebase Admin SDK to create, read, update, delete, and list documents within a Firebase Cloud Firestore collection. See more information in the Cloud Firestore section of the Firebase Admin SDK in the Firebase Docs.

Firebase Connections#

Firebase Private Key Connection#

The Firebase Admin SDK is a set of server libraries that lets you interact with Firebase from privileged environments. To authenticate through the Firebase Admin SDK, follow the instructions to generate a private key located on the Firebase docs This will involve you creating a service account in the Google Cloud Platform and generating credentials for that user. You will receive a JSON file containing many fields including a private key, and client email which you will use to make a new connection. In the new connection, enter the value of the client email, private key, and your GCP project Id.

InputNotesExample
Input
Email
string
/ Required
Notes
Provide the client email for the GCP account.
Example
someone@example.com
Input
Private Key
string
/ Required
Notes
Provide the private key from the Google Cloud Platform.
Example
example- MIIEvdegIBADANBgkqhkiG9w0BAVtkOIcMjQXRzx+2VLoPkAs l1vRkI4wWtbNn6taw01eserX1/vkyxHcByEtkAlaDFrqSlSclRmgRd/ddGWD6xGss9fGIjjJcez4jh 8z6EUeZBAgMBAAECggEAE8vqqRrYdZFNSTOzZN+R/eDzW2nZMiBTqHTl/KvPmp0m fiXX94pJxcRKMEm44n7MFUSdMG3MJoMUeAIs+thYibqkFpXWBCzzq8EzfTuTjR8+ycF+GXWN
Input
Project Id
string
/ Required
Notes
Provide the unique identifier of the project from the Google Cloud Platform.
Example
 

Actions#

Create Document#

Create a document in a Cloud Firestore collection | key: createDocument

InputNotesExample
Input
Collection
string
/ Required
Notes
Provide a string value for the collection name.
Example
Customers
Input
Data
data
/ Required
Key Value List
Notes
Provide a key value pair that represents your data.
Example
 
Input
Connection
connection
/ Required
Notes
 
Example
 

Output Example Payload#

{  "data": {    "id": "",    "path": ""  }}

Delete Document#

Remove a document from a Cloud Firestore collection | key: deleteDocument

InputNotesExample
Input
Collection
string
/ Required
Notes
Provide a string value for the collection name.
Example
Customers
Input
Document
string
/ Required
Notes
Provide a string value for the unique identifier of the document.
Example
/path/to/destination/file.txt
Input
Connection
connection
/ Required
Notes
 
Example
 

Get document#

Get the contents of a document in a Cloud Firestore collection | key: getDocument

InputNotesExample
Input
Collection
string
/ Required
Notes
Provide a string value for the collection name.
Example
Customers
Input
Document
string
/ Required
Notes
Provide a string value for the unique identifier of the document.
Example
/path/to/destination/file.txt
Input
Connection
connection
/ Required
Notes
 
Example
 

Output Example Payload#

{  "data": {    "data": {},    "id": "",    "createTime": "2021-08-25T00:00:00.000Z",    "updateTime": "2021-08-25T00:00:00.000Z",    "exists": true,    "readTime": "2021-08-25T00:00:00.000Z"  }}

List Collections#

List all collections in a Cloud Firestore database | key: listCollections

InputNotes
Input
Connection
connection
/ Required
Notes
 

List Documents#

List all documents in a Cloud Firestore collection | key: listDocuments

InputNotesExample
Input
Collection
string
/ Required
Notes
Provide a string value for the collection name.
Example
Customers
Input
Connection
connection
/ Required
Notes
 
Example
 

Output Example Payload#

{  "data": [    {      "id": "",      "path": ""    }  ]}

Remove Field#

Completely removes a field from a given document (may not work on a field with a null value) | key: removeField

InputNotesExample
Input
Collection
string
/ Required
Notes
Provide a string value for the collection name.
Example
Customers
Input
Document
string
/ Required
Notes
Provide a string value for the unique identifier of the document.
Example
/path/to/destination/file.txt
Input
Field To Remove
string
/ Required
Notes
Provide a string value for the name of the field you would like to remove from the document.
Example
firstName
Input
Connection
connection
/ Required
Notes
 
Example
 

Output Example Payload#

{  "data": {}}

Update Document#

Updates a document in a Cloud Firestore collection | key: updateDocument

InputNotesExample
Input
Collection
string
/ Required
Notes
Provide a string value for the collection name.
Example
Customers
Input
Data
data
/ Required
Key Value List
Notes
Provide a key value pair that represents your data.
Example
 
Input
Document
string
/ Required
Notes
Provide a string value for the unique identifier of the document.
Example
/path/to/destination/file.txt
Input
Connection
connection
/ Required
Notes
 
Example
 

When updating a document, you can specify any number of optional fields to be changed. However, if you would like to unset a value but keep the field, you must pass an unbound input (null, undefined) by using something like the code component or a previous step result. This will result in the field's value becoming null or unset in the document. If you wanted to completely remove this field from the document, you must use the removeField action.