2023-09-27 06:54:39 +00:00
---
id: cosmosdb
title: CosmosDB
---
2023-10-12 09:24:52 +00:00
# Cosmosdb
2023-09-27 06:54:39 +00:00
2023-10-12 09:24:52 +00:00
ToolJet can connect to CosmosDB databases to read and write data.
2023-09-27 06:54:39 +00:00
## Connection
2023-10-12 09:24:52 +00:00
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.
2023-09-27 06:54:39 +00:00
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 ' } } >

< / div >
2023-10-12 09:24:52 +00:00
## Supported Queries:
2023-09-27 06:54:39 +00:00
- [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 )
2023-10-12 09:24:52 +00:00
### Listing Databases
2023-09-27 06:54:39 +00:00
This query lists all the databases in a Cosmos DB.
2023-10-12 09:24:52 +00:00
### Listing Containers
2023-09-27 06:54:39 +00:00
This query lists all the containers of a database in a Cosmos DB.
2023-10-12 09:24:52 +00:00
| Fields | Description |
| -------- | ------------------ |
| database | id of the database |
### Inserting Item(s)
2023-09-27 06:54:39 +00:00
This query inserts one or more items in a container of a database in a Cosmos DB.
2023-10-12 09:24:52 +00:00
| 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
2023-09-27 06:54:39 +00:00
To read a single item from a container of a database in a Cosmos DB, use the following query.
2023-10-12 09:24:52 +00:00
| Fields | Description |
| --------- | ------------------- |
| database | id of the database |
| container | id of the container |
| item | id of the item |
2023-09-27 06:54:39 +00:00
2023-10-12 09:24:52 +00:00
### Deleting An Item
2023-09-27 06:54:39 +00:00
To delete an item from a container of a database in a Cosmos DB, use the following query.
2023-10-12 09:24:52 +00:00
| Fields | Description |
| --------- | ------------------- |
| database | id of the database |
| container | id of the container |
| item | id of the item |
2023-09-27 06:54:39 +00:00
2023-10-12 09:24:52 +00:00
### Querying Documents
2023-09-27 06:54:39 +00:00
To query documents from a container of a database in a Cosmos DB using SQL-like syntax, use the following query.
2023-10-12 09:24:52 +00:00
| 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` |