Create a new document
Last updated
Last updated
This action allows you to create a new document in a Firestore collection.
The neat part here of Firestore is that it doesn't need to have the collection or "table schema" pre-determined. The collection is created by this very action, when you create it's first document.
The name or ID of the collection you want to store the document in.
You can optionally choose a custom ID for the document. This can be useful in some cases. For instance, if you're generating a charge on a service like Stripe, you can link a charge document you create to the charge on Stripe by making them have the same ID.
If left blank, Firestore you generate a Document ID automatically.
If the Custom Doc ID field is set, and there is already a document on the collection with the same ID, this option defines how it will handle this conflicting data.
If checked, the action will behave as an "update" operation on the existing document.
If unchecked, the action will overwrite the existing document, deleting all fields you didn't specify.
If left blank, all listener on the page with blank ID's will be triggered at the same time, so we suggest to always define a Trigger ID.
When you create a document on Firestore, you must inform which fields and which content each will have on it's structure, in JSON format. This input allows you to set as many fields as you want.
For each key/value pair you define and provide a value on the Fields list, you must provide the same key, but with the type of the value, on the Field Types input. That allows the plugin to turn the texts being fed into the plugin into corresponding values on the JSON structure sent to Firestore.
If the number of Fields and Field Types don't match, the action will result in an error.
Document Created (if the action was successful)
Error in Action (if an error occurs)
The ID of the document created by the action.
If an error occurs, you can check its details on this state on the action listener.
This will link the action with a of the same ID.
When the function finishes running, it will trigger the event, storing the on the listener's state.
For each field you must specify the "key" and the "value" that will be stored. For instance, you might want to store the description of a task, as in our , you'd need to define the "key" = "description" and the "value" = "Your description (you can miss the quotes)".
See the to see which types are currently supported by the plugin and how to define them.
Those events are triggered by an with the same ID as the provided on the action.