DocumentDB In The Microsoft Azure

In this article, we are going to see the concept of creating a DocumentDB and uploading JSON documents into it. Also, we will be writing the queries right from Azure portal. Before we proceed to the explanation, let me explain to you about the DocumentDB.


A DocumentDB is a Cloud Service, which is provided by Microsoft Azure. This DocumentDB is a NoSQL database. Here, there is no need of writing the queries. You can directly upload JSON files directly into the database rather than writing the queries.

Creating DocumentDB

Log in to your Azure portal, click on the new button, proceed by clicking the Databases and choose the NoSQL (DocumentDB). This will allow you to create a new DocumentDB. Enter a name for the database and select DocumentDB, choose the location and click on the create button.


Adding Collections

Once DB gets deployed, click DB. You can find a lot of options namely DDm Refresh, Move and Delete. Initially, you can find that there are no collections in DB. To add new collections, click on the +Add Collection. Once you click on the add button, you will be asked to enter the name of the ID. Enter the name, choose the size, give a new database name and click OK button. Once you finish all these, you can find the new collections, which are created in the DB.



Document Explorer

In the menu of DocumentDB, find the option called DocumentExplorer and click Create button. Once you click on the create button, you will be shown a query page. Write JSON query, if you want to write directly from the portal. Once finished writing the query, click Save button. This will save the records, which you wrote as a JSON query.


Query Explorer

Now, click on Query Explorer in the scroll menu and then click Run query button in the top. This will run the default select query, which is in Azure. The records regarding this query will be displayed there.


Uploading JSON files

This is another method of adding the data into the database without the queries. Here, the data will be in the form of JSON files. Create the data, which you would like to upload into the database as JSON files. Now, go to your Document Explorer menu again and then click on the upload button. Now, you will be asked to choose the files. Now, choose the files and click Upload.

Once the files are completely uploaded, they will be displayed under the ID. Here, all the files which you have uploaded will be encrypted. Now, you can see these files by writing a select query.


Seeing uploaded data

Now, go to Query Explorer and run the default query of Azure. It will display the set of data in the uploaded data, which matches up the written query.


This is how a DocumentDB is created and the data is uploaded. This database concept will suit several people who don't like coding. Hope, this will help you in handling the developments that are mainly based on the database. Hope, you have learnt something new. Thank you.

Up Next
    Ebook Download
    View all
    View all