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.

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.

Actions

Bulk Create Documents

Create multiple documents in a Cloud Firestore collection in a single operation | key: bulkCreateDocuments

Output Example Payload

{
"data": "Documents created successfully."
}

Create Document

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

Output Example Payload

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

Delete Document

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


Get Document

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

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

Output Example Payload

{}

List Documents

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

Output Example Payload

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

Remove Field

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

Output Example Payload

{
"data": {}
}

Update Document

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

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.

Output Example Payload

{}