firestore.connector
Purpose
The firestore.connector is a specialized integration designed to connect the Vantage analytics & data platform with Google Firestore, a NoSQL cloud database. This logic allows users to read data from specified Firestore collections by verifying user credentials, fetching data based on specified filters, and enforcing pagination through limits. It streamlines the data retrieval process and ensures secure access to Firestore collections.
Settings
The component has several settings that can be configured to control its behavior. Below is a detailed explanation of each setting:
1. inputs.collection
- Input Type: String
- Description: This setting specifies the Firestore collection from which data is to be retrieved. It is a mandatory field, meaning the integration will throw an error if this is not provided. By changing this setting, users can query different collections in Firestore, thus affecting the dataset being returned.
- Default Value: None (mandatory).
2. inputs.filters
- Input Type: Array of Objects
- Description: This optional setting allows users to specify filtering criteria when querying the Firestore collection. Each filter typically consists of a key and value, allowing for more targeted data retrieval. Implementing filters will refine the results based on specific conditions, thus altering what data is fetched.
- Default Value: Empty array
[](if no filters are provided, all documents within the specified collection will be returned).
3. inputs.limit
- Input Type: Numeric
- Description: This setting defines the maximum number of items to retrieve from the Firestore collection. It acts as a pagination control, limiting results to the specified number. By changing this value, users can manage the volume of data processed at one time, affecting performance and responsiveness.
- Default Value: 50 (if not specified, a default limit of 50 results will be applied).
How It Works
- User Authentication: The integration starts by checking the user session to obtain the
clientId. If the user is not logged in, it raises an error. - Service Validation: The logic then checks whether the Firestore service exists in the database for the specified
clientId. If the service cannot be found, an appropriate message is returned. - Credential Retrieval: Next, it retrieves the client credentials required to authenticate with Firestore. If no credentials are available, it returns an informative message.
- Integration Execution: Upon successfully obtaining the required service and credentials, the logic uses the node to set up the connection to Firestore. It then executes a read-only operation to fetch data according to user-defined parameters (
collection,filters, andlimit). - Error Handling: Any errors during the process will generate a user-friendly error message instead of exposing technical details.
Data Expectations
- Collection Name: The name of the Firestore collection must be valid and should exist within the connected Firestore database.
- Filters: Array of filtering criteria must follow the expected structure for Firestore queries, containing valid fields and values relevant to the collection.
- Limit: The specified numeric limit must be a positive integer, dictating how many documents will be retrieved.
Use Cases & Examples
Use Cases
-
Data Analysis in Marketing: A marketing team wants to analyze user engagement data collected in the Firestore over the last month. They can use the
firestore.connectorto fetch and visualize the data without needing to export it manually. -
Web Application Integration: An e-commerce application needs to display product reviews stored in Firestore. By integrating this logic, the application can dynamically fetch and display reviews based on user interactions, such as filtering by product ID.
-
Real-time Reporting: A reporting team requires access to user activity logs stored in Firestore to generate real-time insights. This integration allows them to pull the latest logs and apply filters as needed, enhancing reporting capabilities.
Example Configuration
Assuming a business case where a marketing team needs to fetch user engagement data based on certain campaign filters, the following configuration could be applied:
{
"inputs": {
"collection": "user_engagements",
"filters": [
{ "key": "campaign", "value": "summer_sale" },
{ "key": "engaged", "value": true }
],
"limit": 100
}
}In this example, the inputs configuration would retrieve all documents from the "user_engagements" collection where the campaign is labeled "summer_sale" and the engagement status is marked as true. The results would be limited to a maximum of 100 entries, making it easy to analyze the campaign's effectiveness without overwhelming data volume.