Skip to main content

Cosmosdb

ToolJet can connect to CosmosDB databases to read and write data.

Connection

To add a new Azure Cosmos DB, click on the + button on data sources panel at the left-bottom corner of the app editor. Select CosmosDB from the modal that pops up.

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.

ToolJet - Data source - CosmosDB

Supported queries:

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.

Fieldsdescription
databaseid of the database

Inserting item(s)

This query inserts one or more items in a container of a database in a Cosmos DB.

Fieldsdescription
databaseid of the database
containerid of the container
itemsitems 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.

Fieldsdescription
databaseid of the database
containerid of the container
itemid of the item

Deleting an item

To delete an item from a container of a database in a Cosmos DB, use the following query.

Fieldsdescription
databaseid of the database
containerid of the container
itemid 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.

Fieldsdescription
databaseid of the database
containerid of the container
queryquery to be executed. Example: SELECT * FROM c WHERE c.age > 20 AND c.age <= 30