Steps to Create Azure Azure Cosmos DB
Step 1: Login to Azure Portal Select the Create Cosmos DB option and select the ‘Create’ option
Step 2: Select the option ‘Create’ from the ‘Azure Cosmos DB for NoSQL’ block
Step 3: This screen shows options to select/input for the cosmos db to be created. Select Resource Group Name, Add a name , Select Location, and Click ‘Review + Create
Step 4:Review and click ‘Create’
Step 5:The Cosmos DB creation progress will be displayed and will display the database details once done.
Next Steps:
Select the database created.
- Add the Collection Name
- Add the Partition Key
- Create a new Document and add some data.
Example data:
{
"id": "1",
"category": "personal",
"name" : "groceries",
"description" : "Pick up apples and strawberries",
"isComplete" : false
}
In the data Explorer window of Azure Portal, from the ‘Read-write Keys’ tab, you can get the URI which will go to the ‘endpoint’ and the primary key value will go to the ‘masterKey’ .
Working with Azure Cosmos DB and JavaScript SDK
Azure Cosmos DB is a No SQL database service that supports flexible schemas and hierarchical data for modern applications. It is a globally distributed, multi-model database service that supports document, key-value, wide-column, and graph databases. Azure Cosmos DB service takes care of database administration, updates, patching, and scaling. It also provides cost-effective serverless and automatic scaling options that match capacity with demand. Cosmos DB integrates with other Azure services and tools, such as Azure Functions, IoT Hub, AKS (Azure Kubernetes Service), App Service, and more. The Azure SDK for JavaScript is a collection of libraries that you can use to interact with various Azure services from your JavaScript applications. It supports both Node.js and browser environments.
In this article, we will learn about working with ‘Azure Cosmos DB and the JavaScript SDK’. CRUD operations and other common operations on Azure Cosmos DB resources can be done using the JavaScript SDK. The Cosmos DB JavaScript SDK is primarily meant for use in Node.js applications.
To work with Azure Cosmos DB, the user needs to create the Cosmos DB by configuring it from the Azure Portal. If you already have an Azure Cosmos DB you can use it by following the steps after the ‘creation of Azure Cosmos DB’. As a prerequisite, users need to have an Azure subscription.
Contact Us