Skip to content

Cloud Firestore

Non-Visible component
Category Requires Version
Google API 21, Android 5.0 Lollipop 1

Overview

A non-visible component that provides access to Google Cloud Firestore for storing and retrieving structured data in real-time.

Permissions

Events

Batch Committed

Triggered when a batch has been committed successfully. 'operationCount' is the number of operations that were committed.

Params
operationCount Number

Collection Changed

Triggered when any document in a listened collection or query changes. 'documents' is the full current result set.

Params
tag Text
collectionPath Text
documents List

Document Added

Triggered when a document has been successfully added. 'documentId' is the auto-generated ID.

Params
collectionPath Text
documentId Text

Document Changed

Triggered when a listened document changes. 'exists' is false if the document was deleted, in which case 'data' is empty.

Params
tag Text
collectionPath Text
documentId Text
data Dictionary
exists Boolean

Document Deleted

Triggered when a document has been successfully deleted.

Params
collectionPath Text
documentId Text

Document Set

Triggered when a document has been successfully set.

Params
collectionPath Text
documentId Text

Document Updated

Triggered when a document has been successfully updated.

Params
collectionPath Text
documentId Text

Firestore Error

Triggered when a Firestore operation fails. 'operation' identifies what failed (e.g., GetDocument, QueryRun). 'message' contains the error details.

Params
operation Text
message Text

Got Document

Triggered when a document has been successfully read. 'data' is a dictionary of the document fields. Empty dictionary if document doesn't exist.

Params
collectionPath Text
documentId Text
data Dictionary

Got Document Exists

Triggered with the result of a document existence check.

Params
collectionPath Text
documentId Text
exists Boolean

Got Documents

Triggered when a collection query returns results. 'documents' is a list of dictionaries, each with an '_id' field for the document ID.

Params
collectionPath Text
documents List

Listener Error

Triggered when a real-time listener encounters an error.

Params
tag Text
message Text

Transaction Completed

Triggered when a transaction completes successfully.

Transaction Failed

Triggered when a transaction fails.

Params
message Text

Transaction Ready

Triggered inside a transaction. Perform all reads (TransactionGet) and writes (TransactionSet, TransactionUpdate, TransactionDelete) here.

Methods

Add Document

Creates a document with an auto-generated ID. Fires DocumentAdded with the generated ID on success or FirestoreError on failure.

Params
collectionPath Text
data Dictionary

Batch Commit

Commits all queued batch operations atomically. Fires BatchCommitted on success or FirestoreError on failure.

Batch Create

Creates a new batch for atomic writes. Replaces any existing uncommitted batch.

Batch Delete

Queues a delete operation on the current batch.

Params
collectionPath Text
documentId Text

Batch Set

Queues a set operation on the current batch.

Params
collectionPath Text
documentId Text
data Dictionary

Batch Update

Queues an update operation on the current batch.

Params
collectionPath Text
documentId Text
data Dictionary

Delete Document

Deletes a document. Fires DocumentDeleted on success or FirestoreError on failure.

Params
collectionPath Text
documentId Text

Document Exists

Checks if a document exists. Fires GotDocumentExists on success or FirestoreError on failure.

Params
collectionPath Text
documentId Text

Get All Documents

Gets all documents in a collection with no filters. Fires GotDocuments on success or FirestoreError on failure.

Params
collectionPath Text

Get Document

Reads a single document from the given collection. Fires GotDocument on success or FirestoreError on failure.

Params
collectionPath Text
documentId Text

Is Listening

Returns: Boolean

Returns whether a listener with the given tag is active.

Params
tag Text

Listen To Collection

Attaches a real-time listener to an entire collection. Fires CollectionChanged with the full result set when any document changes.

Params
tag Text
collectionPath Text

Listen To Document

Attaches a real-time listener to a single document. Fires DocumentChanged when the document changes. If a listener with this tag exists, it is replaced.

Params
tag Text
collectionPath Text
documentId Text

Listen To Query

Attaches a real-time listener using the current query builder state. Fires CollectionChanged when results change. Resets query state after attaching.

Params
tag Text
collectionPath Text

Query Add Filter

Adds a filter to the query. Operators: =, !=, <, <=, >, >=, array-contains, array-contains-any, in, not-in.

Params
field Text
operator Text
value Any

Query End Before

Sets a pagination cursor to end results before the given values. Values must correspond to the QueryOrderBy fields.

Params
values List

Query Limit

Limits the number of query results.

Params
count Number

Query Order By

Adds an ordering clause. Direction must be 'ascending' or 'descending'. Can be called multiple times.

Params
field Text
direction Text

Query Reset

Clears all accumulated query conditions.

Query Run

Executes the accumulated query on the given collection. Fires GotDocuments on success or FirestoreError on failure. Automatically resets the query state after execution.

Params
collectionPath Text

Query Start After

Sets a pagination cursor to start results after the given values. Values must correspond to the QueryOrderBy fields.

Params
values List

Run Transaction

Starts a Firestore transaction. Fires TransactionReady where you must perform all reads and writes. Fires TransactionCompleted on success or TransactionFailed on failure.

Set Document

Creates or overwrites a document with the given data. Fires DocumentSet on success or FirestoreError on failure.

Params
collectionPath Text
documentId Text
data Dictionary

Stop All Listeners

Removes all active listeners.

Stop Listening

Removes the listener identified by the given tag.

Params
tag Text

Transaction Delete

Deletes a document inside a transaction. Can ONLY be called inside the TransactionReady event.

Params
collectionPath Text
documentId Text

Transaction Get

Returns: Dictionary

Reads a document inside a transaction. Can ONLY be called inside the TransactionReady event. Returns the document data as a dictionary.

Params
collectionPath Text
documentId Text

Transaction Set

Sets a document inside a transaction. Can ONLY be called inside the TransactionReady event.

Params
collectionPath Text
documentId Text
data Dictionary

Transaction Update

Updates a document inside a transaction. Can ONLY be called inside the TransactionReady event.

Params
collectionPath Text
documentId Text
data Dictionary

Update Document

Merges fields into an existing document. Fails if the document doesn't exist. Fires DocumentUpdated on success or FirestoreError on failure.

Params
collectionPath Text
documentId Text
data Dictionary

Properties

Project Path

Text ➖ Read Write - Designer Blocks

Gets the project path prefix for this Firestore component.