Introduction to Azure DocumentDB

It is a NoSQL document database as a service on Azure by Microsoft. It embraces industry standard such as JSON, JavaScript, etc. A fully managed service by Microsoft which means no setup, no cluster management for developers. Some of the key features are:

  • It is schema agnostic meaning no enforced schema and is non-relational DB.
  • Data in DocumentDB is automatically indexed.
  • Query language is familiar SQL query.

    • Select columns
    • From tables
    • Where condition

  • DocumentDB integrates with HDInsight, Azure Search and other Azure solutions.

Azure DocumentDB is not the right place to store word, pdf, excel and such documents. Also data like key value pair should be ideally stored in KeyValue store though it can be stored in DocumentDB, it cannot take benefit of document structure. Data stored in DocumentDB is the data that is in JSON format. So what are the use cases then? Some of them are as follows.

DocumentDB

  • Catalog Data: Like Profile Store, Device registry data like in IoT scenarios.

  • Preferences & State: Windows Phone group is using users preferences and state to store in DocumentDB.

  • Events & Logging: Vehicle and equipment manufacturers can use this to log high volumes of data.

  • User Data & Content: Self-explanatory.

  • Data Exchange: Interacting with systems where schema keeps changing.

To try out you need to go to the Azure Preview Portal.

Click New, then Data+Storage, and select Azure DocumentDB as in the following screenshot:

Azure DocumentDB

Mention the database storage account ID, select the resource group and location and create your DocumentDB account. It takes about 10 minutes.

DocumentDB account

If all goes well – you will see the following.

notification

When you click on the newly created DocumentDB, you will see the following empty account.

empty account

We will create a new database. Database accounts can have multiple databases underneath them.

create a new database

When you scroll below Monitoring, you will see the databases. Click on one of them.

see the databases

Now here we can add collections, add or import data to store your JSON data in the database. Click Add Collection, then enter Collection ID.

Enter Collection ID

Click OK, then click on the newly created collection and select Add Document. You can either create json documents or upload existing JSON file.

upload existing JSON file

You can then query this collection

Query document

There are many real life scenarios as mentioned earlier in this article which you can build. I will cover advanced querying in next article.


Similar Articles