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.

Authorization Notes#

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.

Firebase Connections#

Firebase Private Key Connection#

InputKeyNotesExample

Email

string
/ Required
clientEmailProvide the client email for the GCP account.someone@example.com

Private Key

string
/ Required
privateKeyProvide the private key from the Google Cloud Platform.example- MIIEvdegIBADANBgkqhkiG9w0BAVtkOIcMjQXRzx+2VLoPkAs l1vRkI4wWtbNn6taw01eserX1/vkyxHcByEtkAlaDFrqSlSclRmgRd/ddGWD6xGss9fGIjjJcez4jh 8z6EUeZBAgMBAAECggEAE8vqqRrYdZFNSTOzZN+R/eDzW2nZMiBTqHTl/KvPmp0m fiXX94pJxcRKMEm44n7MFUSdMG3MJoMUeAIs+thYibqkFpXWBCzzq8EzfTuTjR8+ycF+GXWN

Project Id

string
/ Required
projectIdProvide the unique identifier of the project from the Google Cloud Platform.

Actions#

Create Document#

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

InputKeyNotesExample

Collection

string
/ Required
collectionProvide a string value for the collection name.Customers

Data

data
/ Required
Key Value List
dataProvide a key value pair that represents your data.

Connection Input

connection
/ Required
firebaseConnection

Output Example Payload#

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

Delete Document#

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

InputKeyNotesExample

Collection

string
/ Required
collectionProvide a string value for the collection name.Customers

Document

string
/ Required
documentProvide a string value for the unique identifier of the document./path/to/destination/file.txt

Connection Input

connection
/ Required
firebaseConnection

Get document#

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

InputKeyNotesExample

Collection

string
/ Required
collectionProvide a string value for the collection name.Customers

Document

string
/ Required
documentProvide a string value for the unique identifier of the document./path/to/destination/file.txt

Connection Input

connection
/ Required
firebaseConnection

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

InputKeyNotes

Connection Input

connection
/ Required
firebaseConnection

List Documents#

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

InputKeyNotesExample

Collection

string
/ Required
collectionProvide a string value for the collection name.Customers

Connection Input

connection
/ Required
firebaseConnection

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

InputKeyNotesExample

Collection

string
/ Required
collectionProvide a string value for the collection name.Customers

Document

string
/ Required
documentProvide a string value for the unique identifier of the document./path/to/destination/file.txt

Field To Remove

string
/ Required
fieldToRemoveProvide a string value for the name of the field you would like to remove from the document.firstName

Connection Input

connection
/ Required
firebaseConnection

Output Example Payload#

{  "data": {}}

Update Document#

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

InputKeyNotesExample

Collection

string
/ Required
collectionProvide a string value for the collection name.Customers

Data

data
/ Required
Key Value List
dataProvide a key value pair that represents your data.

Document

string
/ Required
documentProvide a string value for the unique identifier of the document./path/to/destination/file.txt

Connection Input

connection
/ Required
firebaseConnection

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.