DocumentDB: The move towards NOSQL – Part 1


imageIn the world of DataBases – words like Scale, Performance and Schema flexibility have almost gained the status of a cliché these days – and there is always a reason why some words gain such status – because it is overtly used and most importantly – it is crucial to applications. With scalable internet applications becoming ubiquitous, the need for databases to rise up to such performances needs has never been so high – and this is reflected in the adoption of NOSQL databases. Through this tutorial I will cover the basics of Azure DocumentDB, its design elements and how it is suited for applications these days.

What is NOSQL?

In the world of databases, developers needed structure and relations to play around with data and a rich query language to pull data . The requirements have not changed much other than the previous requirement of stringent structure and relation between data. Today, we live in a world of unstructured and loosely coupled data and this can be attributed to the rise of NOSQL databases. Relational Databases still exist and are very much in use, however they are not capable from a design and performance standpoint for scalability. An Introduction to Azure Data Services explains this difference.

What is Document Database?

Firstly – it is not a database for documents in the traditional sense – as in it is not a database for Word & PDF documents. Document Databases can be thought of as databases dealing with JSON data which may define some kind of a nested hierarchical structure  – which may or note have a schema defined.  Why JSON you ask -JavaScript Object Notation has become a standardized form of representing data in the internet world today. It is self describing – easy to understand and consume. So in general there are several Document Databases in the world today such as Mongo, Raven, Couch and because of its popularity and the its need, Azure has its own flavor of document database and it is called as Azure DocumentDB.

What is Azure DocumentDB?

image

The above diagram shows how Azure DocumentDB fits in Data Services from Azure. On one extreme is traditional OnPrem Relational SQL Server – SQL Server in a VM, on the other extreme is Table and Blobs – which is arbitrary forms of Data and can be thought of as Non-Relational or NOSQL databases. As we move from left to right – you will notice that it is moving from fully unmanaged to managed and from relational to non-relational. DocumentDB sits beautifully in between – as a fully managed schema-free JSON database for modern applications – has a rich query language and hence can be thought of as an ideal mix of both worlds.

Design Elements

The four pillars of Azure Document DB are:

  1. Supports a rich query language
  2. Supports multi-document transactions
  3. It is tuned for high performance
  4. It is a fully managed service

Lets get Started!

Lets login to the new portal – portal.azure.com and create our first database account on Azure DocumentDB.

image

The database account takes about 10 minutes to create it. Once it is created, you can either access it from the dashboard itself (if you have pinned it) else you can go to All Resources –> and find the documentDB resource that you just created.

image

 

Now that the DocumentDB is created, let us access the access the connection strings:

image

Lets play around with this and add a data base to this account:

image

Once you have created a DB, you can add a collection to your database and in that collection you can add a document:

image

 

This document is your JSON. You can edit it, save it and use it at your will. You can also import your own JSON files here too and start using accordingly. Most important thing to understand is that using the connection string, now you can connect your application to this database or collection and start using it. Important thing to keep in mind is that Azure DocumentDB is natively supported as a managed service in Azure and supports all features of a highly scalable and a performing database. In short the below diagram beautifully summarizes the structure elements of Azure DocumentDB

SNAGHTMLdfa71d9

That’s it for the introduction. This is just the beginning and I ll delve into more about Azure DocumentDB and take you through your journey from Relational to Document Databases. This video gives a good description of NOSQL and why we need Microsoft AzureDocumentDB and how it integrates with web based, JSON, solutions. Most importantly there are tones of documentation  available to help you in this journey, infact most of post is covered in greater detail in this Microsoft Virtual Academy Course: Developing Solutions with DocumentDB. If you have any specific queries, please feel free to reach out to me @AdashaDatta – would love to hear about your journey in Azure!


Comments (0)

Skip to main content