ToolJet/docs/versioned_docs/version-2.33.0/data-sources/firestore.md

153 lines
5.4 KiB
Markdown
Raw Normal View History

Release: Community changes (v2.34.0) (#9226) * add custom resolvers info and editable row selection info (#9057) * fix system requirements icon * add auth info for webhooks and fix casing * add regex custom validation info (#9068) * [docs]: Marketplace 1.7 updates (#9085) * [docs] Amazon redshift plugin * make minor improvements * add and update docs for marketplace 1.7 * update order of plugins in overview to match sidebar * create new version --------- Co-authored-by: Shubhendra <withshubh@gmail.com> * add the latest version in the versions.json file (#9094) * [docs]: Update PDF component (#9088) * update PDF component * merged with develop and added changes to the new version * update docs favicon: (#9118) * [docs] SSO revamp (#9031) * add method to set default language * update image settings through custom css and update screenshots for getting started and tooljet concepts (#9158) * fix read documentation button * fix formatting for setup icons (#9172) * fix sidebar link for aws lambda * Update static media (#9175) * updated the screenshots * reduced the gif size * reverted the package.json file * edited the zoomed in images and replaced some gifs with screenshots * removed one gif * update static media * update file names * update toolbar * fix file names * fix: dynamodb img path * update media for org management dashboard * fix: casing and formatting * update workspace constant media * update media in workspace settings and github * update github sso * minor change to github sso docs * minor fix * update google sso * change includeCurrentVersion flag to false --------- Co-authored-by: Asjad Ahmed Khan <iitasjad2001@gmail.com> Co-authored-by: Asjad Ahmed Khan <60435499+2001asjad@users.noreply.github.com> Co-authored-by: Karan Rathod <karan.altcampus@gmail.com> * Feature: Engagespot plugin (#9012) * feat(plugins): added engagespot plugin * feat(docs): added engagespot plugin docs * chore(engagespot-plugin): revised copywritings * Feature: Databricks data source (#9174) * plugin-created * Databricks integration * icon, error handling * removed unrelated changes from marketplace and frontend package-lock.json removed runAsync and maxRows timeouts pending * timeout implementation * socket timeout and error handling * resolve comments * resolve comments2 * solved render issue test connection improvements * solved undefined error * fix TJDB not null value fail for is operation (#9055) * fix TJDB not null value fail for is operation * handling not null and null case insenstive values * Support for marketplace plugin deploy on render preview app (#9221) * Fix for marketplace error on render preview app * add marketplace build command * Adding new workflow for building marketplace plugin * removed render app creation * [:docs] Add documentation for Databricks plugin (#9224) * add docs for databricks * update databricks docs * update docs * remove ref to clusters * bump to v2.34.0 * Fixed data source cypress failure (#9227) * updated spec with required text * updated mongodb and import spec * updated import spec --------- Co-authored-by: Karan Rathod <karan.altcampus@gmail.com> Co-authored-by: Adish M <44204658+adishM98@users.noreply.github.com> Co-authored-by: Midhun G S <gsmithun4@gmail.com> Co-authored-by: Shubhendra <withshubh@gmail.com> Co-authored-by: Aman Regu <amanregu@gmail.com> Co-authored-by: Asjad Ahmed Khan <iitasjad2001@gmail.com> Co-authored-by: Asjad Ahmed Khan <60435499+2001asjad@users.noreply.github.com> Co-authored-by: Jobin Jose <129726530+jobin-logidots@users.noreply.github.com> Co-authored-by: Syed Mohammad Akhtar Rizvi <85864291+ShazanRizvi@users.noreply.github.com> Co-authored-by: blank0537 <111295371+blank0537@users.noreply.github.com> Co-authored-by: Mekhla Asopa <59684099+Mekhla-Asopa@users.noreply.github.com>
2024-03-29 13:43:26 +00:00
---
id: firestore
title: Cloud Firestore
---
# Cloud Firestore
ToolJet can connect to Cloud Firestore databases to read and write data.
## Connection
ToolJet connects to your Cloud Firestore using JSON key of your GCP service account. Get your service account key as JSON from GCP console. For generating a new key, check out [Firestore's official documentation](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-console).
Once you have the key, open it in a text editor and copy the contents. Paste the contents in the **Private key** field of the Firestore data source modal.
Click on **Test connection** button to verify if the key is valid. Click on **Save** button to save the data source.
<img className="screenshot-full" src="/img/datasource-reference/firestore/add-ds-firestore-v2.png" alt="firestore add ds"/>
## Querying Firestore
Click on `+` button of the query manager at the bottom panel of the editor and select the database added in the previous step as the data source.
<img className="screenshot-full" src="/img/datasource-reference/firestore/firestore-query.png" alt="firestore QUERY" />
Select the operation that you want to perform on Firestore and click **Save** to save the query.
:::tip
Query results can be transformed using transformations. Read our transformations documentation to see how: **[link](/docs/tutorial/transformations)**
:::
## Supported operations
1. [Get document](#get-document)
2. [Query collection](#query-collection)
3. [Add Document to Collection](#add-document-to-collection)
4. [Update document](#update-document)
5. [Set document](#set-document)
6. [Bulk update using document id](#bulk-update-using-document-id)
7. [Delete document](#delete-document)
### Get document
Use this operation to get the data in a document.
#### Required parameters:
- **Path**: Enter the path of the document. Path format: `collection name/document id`. ex: `books/23e2wsds32`
<img className="screenshot-full" src="/img/datasource-reference/firestore/get.png" alt="firestore get" />
### Query collection
Use this operation to query all the documents in a collection. Check firestore doc [here](https://firebase.google.com/docs/reference/js/v8/firebase.database.Query).
#### Required parameters:
- **Path**: Enter the name of the collection to be queried. Example: `books`
#### Optional parameters:
- **Order type**: Select ascending or descending from the dropdown.
- **Limit**: Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request. The Limit value should be of integer type.
- **Field, Operator, and Value**: For filtering the results, you can enter a document field name, use appropriate operator from the dropdown and set a value.
<img className="screenshot-full" src="/img/datasource-reference/firestore/query-collection.png" alt="firestore collection"/>
### Add Document to Collection
Use this operation for creating a new document in a collection.
#### Required parameters:
- **Collection**: Enter the path of the document in a collection. Path format: `collection name/document id`. ex: `books/33243dwe2332`
- **Body**: Enter the Field names and their values in json form. example body:
```json
{
"Author": "Shubh",
"id": 5
}
```
<img className="screenshot-full" src="/img/datasource-reference/firestore/add-document.png" alt="firestore document" />
### Update document
Use this operation for updating the existing document in a collection. Also, it only updates fields if they exist, but doesn't replace an entire object like [set operation](#set-document).
#### Required parameters:
- **Path**: Enter the path of the document in a collection. Path format: `collection name/document id`. ex: `books/33243dwe2332`
- **Body**: Enter the Field names and their values in json form. example body:
```json
{
"Author": "Shubhendra",
"id": 3
}
```
<img className="screenshot-full" src="/img/datasource-reference/firestore/update.png" alt="firestore update" />
### Set document
This operation replaces your chosen object with the value that you provide. So if your object has 5 fields, and you use Set operation and pass object with 3 fields, it will now have 3 fields.
#### Required parameters:
- **Path**: Enter the path of the document in a collection. Path format: `collection name/document id`. ex: `books/33243dwe2332`
- **Body**: Enter the Field names and their values in json form. example body:
```json
{
"Author": "Shefewfbh",
"id": 9
}
```
<img className="screenshot-full" src="/img/datasource-reference/firestore/set.png" alt="firestore set" />
### Bulk update using document id
Use this operation for bulk updating documents.
#### Required parameters:
- **Collection**:
- **Key for document ID**:
- **Records**:
<img className="screenshot-full" src="/img/datasource-reference/firestore/bulk.png" alt="firestore bulk" />
### Delete document
Use this operation for deleting a document in a collection.
#### Required parameters:
- **Path**: Enter the path of the document to be deleted in a collection. Path format: `collection name/document id`. ex: `books/33243dwe2332`
<img className="screenshot-full" src="/img/datasource-reference/firestore/delete.png" alt="firestore delete"/>
## Transforming firestore query result for Table widget
The Firestore query result is in the form of object so well need to transform it into array.
```js
return (data = Array(data));
```