Introduction to Microsoft Azure DocumentDB
This article provides an introduction to Microsoft Azure DocumentDB for developers, IT Pros, and business decision makers. By reading it, you learn:
- What Azure DocumentDB is and the value it provides to your cloud and mobile applications
- How your data is managed in Azure DocumentDB
- How to access data and develop applications using Azure DocumentDB
- Where to go next to build your first Azure DocumentDB application
What is Azure DocumentDB?
Modern applications produce, consume and respond quickly to very large volumes of data. These applications evolve very rapidly and so does the underlying data schema. In response to this, developers have increasingly chosen schema-free NoSQL databases as simple, fast, elastic solutions to store and process data while preserving the ability to quickly iterate over application data models and unstructured data feeds. However, many schema-free databases do not allow non-trivial queries and transactional processing, making advanced data management hard. Microsoft developed Azure DocumentDB to provide these capabilities when managing schema-free data.
Azure DocumentDB offers the following key capabilities and benefits:
Ad hoc queries with familiar SQL syntax: Store heterogeneous JSON documents within DocumentDB and query these documents through a familiar SQL syntax. DocumentDB utilizes a highly concurrent, lock free, log structured indexing technology to automatically index all document content. This enables rich real-time queries without the need to specify schema hints, secondary indexes or views.
Tunable consistency levels: Select from four well defined consistency levels to achieve optimal trade-off between consistency and performance. For queries and read operations, DocumentDB offers four distinct consistency levels - Strong, Bounded-Staleness, Session, and Eventual. These granular, well-defined consistency levels allow you to make sound trade-offs between consistency, availability and latency.
Fully managed: Eliminate the need to manage database and machine resources. As a fully-managed Microsoft Azure service, you do not need to manage virtual machines, deploy and configure software, or deal with complex data-tier upgrades. Every database is automatically backed up and protected against regional failures. You can easily add a DocumentDB account and provision capacity as you need it, allowing you to focus on your application vs. operating and managing your database.
Elastically scalable throughput and storage: Easily scale up or down DocumentDB to meet your application needs. Scaling is done through fine grained units of reserved SSD backed storage and throughput. You can elastically scale DocumentDB with predictable performance by purchasing more capacity units, as your application grows.
You can use Azure DocumentDB to store flexible datasets that require query retrieval and transactional processing. Application scenarios may include user data for interactive web and mobile applications as well as storage, retrieval and processing of application JSON data. A database can store any number of JSON documents, as such DocumentDB is well suited for applications that run at internet scale.
Azure DocumentDB Resources
Azure DocumentDB manages data through well-defined database resources. These resources are replicated for high availability and uniquely addressable by their logical URI. DocumentDB offers a simple HTTP based RESTful programming model for all resources.
The DocumentDB database account is a unique namespace that gives you access to Azure DocumentDB. Before you can create a database account, you must have an Azure subscription, which is a plan that gives you access to a variety of Azure services.
All resources within Azure DocumentDB are modeled and stored as JSON documents. Resources are managed as items, which are JSON documents containing metadata and as feeds which are collections of items. Sets of items are contained within their respective feeds.
The image below shows the relationships between the Azure DocumentDB resources:
A database account consists of a set of databases, each containing multiple collections, each of which can contain stored procedures, triggers, UDFs, documents and related attachments. A database also has associated users each with a set of permissions to access various other collections, stored procedures, triggers, UDFs, documents or attachments. While databases, users, permissions and collections are system defined resources with well-known schemas, documents, stored procedures, triggers, UDFs and attachments contain arbitrary, user defined JSON content.
Developing Against Azure DocumentDB
Azure DocumentDB exposes resources via a REST API that can be called by any language capable of making HTTP/HTTPS requests. Additionally, Azure DocumentDB offers programming libraries for several popular languages. These libraries simplify many aspects of working with Azure DocumentDB by handling details such as address caching, exception management, automatic retries and so forth. Libraries are currently available for the following languages and platforms, with others on the way:
For .NET developers, Azure DocumentDB also offers a LINQ query provider as part of the .NET SDK.
To get started with Azure DocumentDB, explore these resources: