Playing with Azure NoSQL Database - Azure Cosmos DB | Scribe

    Playing with Azure NoSQL Database - Azure Cosmos DB

    • Hafeez Baig |
    • 20 steps |
    • 2 minutes
    information ordinal icon

    Refer to this guide to learn how to create a NoSQL Database CosmosDB in Azure\ <https://scribehow.com/shared/Exploring_Azure_NoSQL_Database__Azure_Cosmos_DB__BQBjTNelSuWakwsHgt3WkA>

    1

    Sign in into the **Microsoft Azure Portal**

    2

    Type **Azure Cosmos DB** in the search bar and click on the **Azure Cosmos DB** to view the Azure Cosmos DB dashboard

    information ordinal icon

    **What is Azure Cosmos DB?**\ \ Azure Cosmos DB is a globally distributed, multi-model database service by Microsoft Azure, designed for scalable, responsive applications. It supports various data models (document, key-value, graph, column-family) and APIs (SQL, MongoDB, Gremlin, Table, Cassandra). Cosmos DB offers automatic scaling, high availability, low latency, and multiple consistency levels, with comprehensive SLAs.

    3

    On the **Azure Cosmos DB** dashboard, click on the Name **my-first-cosmosdb-in28**

    4

    **Quick start** wizard will open, here you can choose a platform to connect your MongoDB app and you can have multiple ways to connect to your Database

    5

    Click on the **Data Explorer** from the left bar

    information ordinal icon

    **What is Data Explorer?**\ \ Azure Data Explorer (ADX) is a fast, scalable data analytics service by Microsoft Azure, designed for real-time analysis of large volumes of streaming and log data. It supports high-performance, sub-second query times for analyzing terabytes of data and uses the powerful Kusto Query Language (KQL).

    6

    **Data Explorer** wizard will open, click on the **New Collection** button on the top left side to create a new collection in your Database

    7

    On the right side **New Collection** wizard will open, give the Database name as "**mongo-db-database**"

    8

    Scroll to the **Collection id** section, and give id as "**mongodb-collection**"

    information ordinal icon

    **What is Collection?**\ \ In Azure Cosmos DB, a "Collection" is a container for storing JSON documents. It supports flexible data models, high throughput, low latency, global distribution, and automatic scaling. Collections enable efficient querying, indexing, and are compatible with multiple APIs like SQL, MongoDB, Gremlin, Table, and Cassandra.

    9

    Scroll to the **Shard key** section, give key as "**id**"

    information ordinal icon

    **What is Shard key?**\ \ A shard key is a specific field or combination of fields used to distribute data across multiple shards in a database, enabling horizontal scaling. It determines how data is partitioned and stored in different shards, which are subsets of the database. By carefully selecting a shard key, databases can achieve balanced distribution of data and workload, improving performance and scalability.

    10

    Scroll the page and click on the **OK** button to create a new collection

    11

    On the **Data Explorer** wizard, click on the **mongo-db-database** option on the left side

    12

    Click on the **mongodb-collection** from the dropdown which we have created earlier in this scribe

    13

    Click on the **Documents** option to view all the documents in the collection

    14

    Click on the **New Document** button on the top to create a new document in the collection

    15

    **mongodb_Document** wizard will open, type the below JSON code\ \ {\ "id" : "1",\ "description" : "Become AZ Certified",\ "name" : "John"\ } **Note:** This is an example code that contains an *id*, *description* and a *name*, you can add multiple values and modify it.