ToolJet/docs/versioned_docs/version-2.65.0/data-sources/cosmosdb.md
Pratik Agrawal f6bef78dec
[docs]: Update data-sources guides - databrick, dynamodb, elasticsearch, gcs, sheets, graphql (#10737)
* [docs]: Update data-sources guides - Clickhouse, CosmosDB, CouchDB

* Added padding before h2

* Updated 2.50-LTS/data-source/databricks.md

* Updated Databrick

* Updated DynamoDB

* Updated elasticsearch

* Updated GCS

* Updated Google Sheets

* Updated GraphQL

* Updated graphql v2

* Updated graphql v3

* Updated sheets v2

* updated sheets v3

* Updated gcs v2

* updated elasticsearch v2

* updated dynamodb v2

* Updated databrick v2

* Added missing images

* Updated docs in 2.68.0
2024-09-17 16:03:33 +05:30

93 lines
No EOL
3.2 KiB
Markdown

---
id: cosmosdb
title: CosmosDB
---
ToolJet can connect to CosmosDB databases to read and write data.
## Connection
To establish a connection with the CosmosDB data source, you can either click on the **+ Add new data source** button located on the query panel or navigate to the **[Data Sources](/docs/data-sources/overview)** page through the ToolJet dashboard.
ToolJet requires the following to connect to your Cosmos DB.
- **Cosmos DB Account End point**
- **Cosmos DB Account Key**
:::info
**Azure Cosmos DB End point** is the URL of the Cosmos DB service.
**Azure Cosmos DB Key** is the key that is used to access the Cosmos DB service.
You can find the endpoint and key in the **[Azure Portal](https://portal.azure.com/)**.
:::
<div style={{textAlign: 'center'}}>
![ToolJet - Data source - CosmosDB](/img/datasource-reference/cosmosdb/cosmosdb-connect-v2.png)
</div>
<div style={{paddingTop:'24px'}}>
## Supported Queries:
- **[Listing databases](#listing-databases)**
- **[Listing containers](#listing-containers)**
- **[Inserting item(s)](#inserting-items)**
- **[Retrieving an item](#retrieving-an-item)**
- **[Deleting an item](#deleting-an-item)**
- **[Querying documents](#querying-documents)**
### Listing Databases
This query lists all the databases in a Cosmos DB.
### Listing Containers
This query lists all the containers of a database in a Cosmos DB.
| Fields | Description |
| -------- | ------------------ |
| database | id of the database |
### Inserting Item(s)
This query inserts one or more items in a container of a database in a Cosmos DB.
| Fields | Description |
| --------- | ---------------------------------------------------------------------------------- |
| database | id of the database |
| container | id of the container |
| items | items to be inserted. Example: `{{[{name: "one", val: 1}, {name:"two", val: 2}]}}` |
### Retrieving An Item
To read a single item from a container of a database in a Cosmos DB, use the following query.
| Fields | Description |
| --------- | ------------------- |
| database | id of the database |
| container | id of the container |
| item | id of the item |
### Deleting An Item
To delete an item from a container of a database in a Cosmos DB, use the following query.
| Fields | Description |
| --------- | ------------------- |
| database | id of the database |
| container | id of the container |
| item | id of the item |
### Querying Documents
To query documents from a container of a database in a Cosmos DB using SQL-like syntax, use the following query.
| Fields | Description |
| --------- | --------------------------------------------------------------------------------- |
| database | id of the database |
| container | id of the container |
| query | query to be executed. Example: `SELECT * FROM c WHERE c.age > 20 AND c.age <= 30` |
</div>