Type "firestoreCollectionPath"

Frequently you might find yourself writing a function that reads or writes into the Firestore database document. The same solution (the function code) could be used in the same project or in others, but reading or writing into different paths. For example, a function that syncs a Firestore collection with a BigQuery table could be used multiple times to synchronize different Firestore collections.

If you are writing a function that requires a document path in the Firestore database, either because you want to read or write to that document, you can use environment variables of type firestoreCollectionPath in your implementation, and then our platform will ask consumers to enter its value during installation.‌‌

The variables type firestoreCollectionPath allow the consumers of a function to enter any firestore document path valid. It is presented in the installation UI form as an input element (see image below).

Example of an environment variable type "firestoreCollectionPath" definition

"env": [
    {
        "name": "STRIPE_CUSTOMERS_COLLECTION_PATH",
        "description": "The collection path where the Stripe customers are stored.",
        "required": true,
        "type": "firestoreCollectionPath",
        "default": "/users"
    }
]

Example of how to consume the value of the environment variable within the function implementation

const myFunction = () => {
    const collectionPath = process.env.COLLECTION_PATH
    ...
};

module.exports = myFunction;

Properties of the type

Last updated