In 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?
What is Azure DocumentDB?
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.
The four pillars of Azure Document DB are:
Supports a rich query language
Supports multi-document transactions
It is tuned for high performance
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.
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.
Now that the DocumentDB is created, let us access the access the connection strings:
Lets play around with this and add a data base to this account:
Once you have created a DB, you can add a collection to your database and in that collection you can add a document:
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
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!