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.
Input | Notes | Example |
---|---|---|
Email string / Required clientEmail | Provide the client email for the GCP account. | someone@example.com |
Private Key text / Required privateKey | Provide 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 projectId | Provide the unique identifier of the project from the Google Cloud Platform. |
Actions
Bulk Create Documents
Create multiple documents in a Cloud Firestore collection in a single operation | key: bulkCreateDocuments
Input | Default | Notes | Example |
---|---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers | |
Documents code / Required documents | An array of documents to be created in the collection. | ||
Connection connection / Required firebaseConnection |
Example Payload for Bulk Create Documents
{
"data": "Documents created successfully."
}
Create Document
Create a document in a Cloud Firestore collection | key: createDocument
Input | Notes | Example |
---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers |
Data data / Required Key Value List data | Provide a key value pair that represents your data. | |
Connection connection / Required firebaseConnection |
Example Payload for Create Document
{
"data": {
"id": "",
"path": ""
}
}
Delete Document
Remove a document from a Cloud Firestore collection | key: deleteDocument
Input | Notes | Example |
---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers |
Document string / Required document | Provide a string value for the unique identifier of the document. | /path/to/destination/file.txt |
Connection connection / Required firebaseConnection |
Get Document
Get the contents of a document in a Cloud Firestore collection | key: getDocument
Input | Notes | Example |
---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers |
Document string / Required document | Provide a string value for the unique identifier of the document. | /path/to/destination/file.txt |
Connection connection / Required firebaseConnection |
Example Payload for Get Document
{
"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
Input | Notes |
---|---|
Connection connection / Required firebaseConnection |
Example Payload for List Collections
{}
List Documents
List all documents in a Cloud Firestore collection | key: listDocuments
Input | Notes | Example |
---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers |
Connection connection / Required firebaseConnection | ||
Order By string orderBy | Provide a string value for the field to order by. | Name |
Query Operators code queryOperatorCode |
Example Payload for List Documents
{
"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
Input | Notes | Example |
---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers |
Document string / Required document | Provide a string value for the unique identifier of the document. | /path/to/destination/file.txt |
Field To Remove string / Required fieldToRemove | Provide a string value for the name of the field you would like to remove from the document. | firstName |
Connection connection / Required firebaseConnection |
Example Payload for Remove Field
{
"data": {}
}
Update Document
Updates a document in a Cloud Firestore collection | key: updateDocument
Input | Notes | Example |
---|---|---|
Collection string / Required collection | Provide a string value for the collection name. | Customers |
Data data / Required Key Value List data | Provide a key value pair that represents your data. | |
Document string / Required document | Provide a string value for the unique identifier of the document. | /path/to/destination/file.txt |
Connection 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.
Example Payload for Update Document
{}