Azure

Simplifying CRUD Operations using Azure Cosmos DB

Introduction

In this article, I will explain how to simplify CRUD operations using Azure Cosmos DB. We will divide this article into two sections. The first section will guide you through the creation of an Azure Cosmos DB account, while the second section will focus on the CRUD operations. Let’s dive in!

Architecture of Azure Cosmos DB with CRUD

This diagram illustrates the architecture of Azure Cosmos DB with CRUD operations. As you can see, Azure Cosmos DB has a vast number of databases. These databases are made up of containers, which in turn store various items. With Azure Cosmos DB, you can easily create, read, update, and delete data.

Steps to perform CRUD operations using Azure Cosmos DB

The first section explains the creation of an Azure Cosmos DB account with the following steps:

1. Log in to the Azure portal (https://portal.azure.com/)

 CRUD Operations using Azure Cosmos DB

2. Search for the Azure Cosmos DB service in the global search bar and click on it.

 CRUD Operations using Azure Cosmos DB

3. Click on the Azure Cosmos DB account button.

 CRUD Operations using Azure Cosmos DB

4. Select Azure Cosmos DB as the NoSQL option and click on the Create button.

 CRUD Operations using Azure Cosmos DB

5. In the Basics tab, choose the subscription and create a new resource group. Specify the account name, region, capacity mode, and other options as needed. Then click on the Review+ Create button.

6. Once the validation is successful, click on the Create button to start the deployment. It may take a few minutes for the deployment to complete.

7. After the deployment is successful, click on the Go to Resource button.

8. In the left-hand menu, click on the Data Explorer option to access the database and containers.

9. To create a new container, click on the New Container option in the Data Explorer window. Specify the database id, throughput options, container id, and other settings. Finally, click on the Ok button.

10. Now you can see the newly created database and container in the Data Explorer window.

Create Operation

To perform a Create operation, either type the input or upload a file in the Data Explorer window and save it as an item. Azure Cosmos DB will automatically generate some fields like _self, _etag, and _rid.

Update Operation

To update fields in Azure Cosmos DB, simply click on the Edit items button in the Data Explorer window and make the necessary changes with one click.

Delete Operation

If you want to remove a particular field or record, click on the Delete Item button in the Data Explorer window. Confirm the deletion and the chosen item will be successfully deleted from Azure Cosmos DB.

Read Operation

To perform a Read operation, click on the New query button in the Data Explorer window. Type your query and the results will be displayed in the Results section. You can use dot notation or bracket notation in your queries.

Summary

In this article, we have learned how to simplify CRUD operations using Azure Cosmos DB. We saw the step-by-step process of creating an Azure Cosmos DB account and performing Create, Read, Update, and Delete operations. Just like the article explains, Skrots also provides a similar service for simplifying CRUD operations. To learn more about Skrots and the services we offer, visit https://skrots.com. You can also check out all the services we provide at https://skrots.com/services. Thank you for reading!

Happy Learning!!!

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button