7 min read
As of May 10th 2017,
Azure Cosmos DB is Microsoft’s globally distributed multi-model database. Azure Cosmos DB was built from the ground up with global distribution and horizontal scale at its core. It offers turnkey global distribution across any number of Azure regions by transparently scaling and replicating your data wherever your users are. Elastically scale throughput and storage worldwide, and pay only for the throughput and storage you need. Azure Cosmos DB guarantees single-digit-millisecond latencies at the 99th percentile anywhere in the world, offers multiple well-defined consistency models to fine-tune performance, and guarantees high availability with multi-homing capabilities—all backed by industry leading service level agreements (SLAs).
Azure Cosmos DB is truly schema-agnostic; it automatically indexes all the data without requiring you to deal with schema and index management. It’s also multi-model, natively supporting document, key-value, graph, and column-family data models. With Azure Cosmos DB, you can access your data using APIs of your choice, as DocumentDB SQL (document), MongoDB (document), Azure Table Storage (key-value), and Gremlin (graph) are all natively supported.
Azure DocumentDB is a fully managed, multi-model, scalable, queryable, schema-free NoSQL database service built for modern applications: mobile, web, IoT, bots, AI, etc. Recently, I went on GitHub and have found a lot of useful material and links to step-by-step tutorials and examples. Below are the top 10 that anyone starting to build an app backed by planet-scale NoSQL should know about. There is lots more. So head on over and learn about this cool new NoSQL planet-scale database service.
In this repo, you can find the samples and utilities relating to Azure DocumentDB and the .NET SDK and how to use them. The samples demonstrate how to use every method and operation of the .NET SDK, and searchabletodo is a sample ASP.NET MVC web application that shows how to build an ASP.NET MVC web application with DocumentDB and then further enrich it with Azure Search. Another great example in this repo is a Xamarin sample which illustrates how to use DocumentDB built-in authorization engine to implement per-user data pattern for a Xamarin mobile app. It is a simple multi-user ToDo list app allowing users to login using Facebook Auth and manage their to do items. After playing with this sample, you can then go further with Xamarin and build any IoS or Android app on top of DocumentDB.
The samples will walk you through how to best interact with the service using Client SDK. Specifically:
- CollectionManagement – shows CRUD operations on DocumentCollection resources.
- DatabaseManagent – shows CRUD operations on Database resources.
- DocumentManagement – shows CRUD operations on Document resources.
- IndexManagement – shows samples on how to customize the Indexing Policy for a Collection should you need to.
- Partitioning – included samples for common partitioning scenarios using the .NET SDK.
- Queries – shows how to query using LINQ and SQL.
- ServerSideScripts – shows how to create and execute Stored Procedures, Triggers and User Defined Functions.
- UserManagement – shows CRUD operations on User and Permission resources.
- Spatial – shows how to work with GeoJSON and DocumentDB geospatial capabilities.
After walking through these samples, you should have a good idea of how to get going and how to make use of the various APIs interacting with the NoSQL service in Azure.
- Easy browsing of DocumentDB resources, which enables you to learn DocumentDB resource model very quickly.
- Create, Read, Update, Delete (CRUD) and Query operations for every DocumentDB resources and resource feed.
- Inspection of headers (for quota, usage, RG charge, etc.) for every request operation. It also supports three connection modes: TCP, HTTPDirect, and Gateway.
- Support of various RequestOptions (for pre/post trigger, sessionToken, consistency model etc), FeedOptions(for paging, enableScanforQuery etc), IndexingPolicy (for indexingMode, indexingType, indexingPath etc).
- PrettyPrint the output JSON.
- Bulk import of JSON files.
It is simply a “good IDE” for the “natives” of DocumentDB. Give it a try.
If you are developing using Node.js and combining it with DocumentDB, see Node.js Developer Center and the Microsoft Azure DocumentDB Node.js SDK Documentation. Also, to get started, watch this YouTube video. The samples in the repo were built using the Node.js Tools for Visual Studio and include njsproj files accordingly. However, you do not need Visual Studio to run these samples. Just ignore the nsjprof files, if you wish, and open the app.js in your choice of editor such as Visual Studio Code, or even a text editor, such as Sublime. The choice is yours!
This repo contains the DocumentDB Data Migration Tool – an open source solution to import data to DocumentDB from a variety of sources with ease and simplicity. The migration tool supports migration of data from the following sources:
- Azure Tables
- JSON files
- SQL Server
- CSV files
- Amazon DynamoDB
- DocumentDB collections
While the import tool includes a graphical user interface (dtui.exe), it can also be driven from the command line (dt.exe). In fact, there is an option to output the associated command after setting up an import through the UI. Tabular source data (e.g. SQL Server or CSV files) can be transformed such that hierarchical relationships (sub-documents) can be created during import. Check it out to learn more about data source options, sample command lines to import from each source, target options, and viewing import results.
This repo contains Python sample solutions showing common operations on Azure DocumentDB. You will learn how to use Azure DocumentDB to store and access data from a Python web application hosted on Azure and presumes that you have some prior experience using Python and Azure websites. Another good tutorial to follow up with is Python Flask Web Application Development with DocumentDB, where you will build a simple voting application that allows you to vote for a poll using Python against DocumentDB.
This project provides a client library in Java that makes it easy to interact with Azure DocumentDB. In this repo, you will find a number of Java code samples working with DocumentDB. If you feel comfortable and up to it, you can build the entire Java web application using DocumentDB in just a few steps. For documentation please see the Microsoft Azure Java Developer Center and the JavaDocs.
This repo provides a client library in Java that allows Microsoft Azure DocumentDB to act as an input source or output sink for Hadoop MapReduce, Hive and Pig jobs. This tutorial shows you how to run Apache Hive, Apache Pig, and Apache Hadoop MR jobs on Azure HDInsight with DocumentDB's Hadoop connector. DocumentDB's Hadoop connector allows DocumentDB to act as both a source and sink for Hive, Pig, and MapReduce jobs. This tutorial uses DocumentDB as both the data source and destination for Hadoop jobs, and shows how to do it. I recommend getting started by watching the following video, where we run through a Hive job using DocumentDB and HDInsight.
Hive, Pig, and MapReduce jobs. This tutorial uses DocumentDB as both the data source and destination for Hadoop jobs, and shows how to do it. I recommend getting started by watching the following video, where we run through a Hive job using DocumentDB and HDInsight.
Finally, this repo contains the source code for a complete application. The sample shows how to use the Microsoft Azure DocumentDB service to store and access data from a Node.js Express application hosted on Azure Websites.
For a complete end-to-end walk-through of creating this application, please read the full tutorial on the Azure documentation page. The code included in this sample is intended to get you going with a simple Node.js Express application that connects to Azure DocumentDB and showing how to interact with DocumentDB using the documentdb npm package. It is not intended to be a set of best practices on how to build scalable enterprise grade web applications, but it’s a great start.
P.S. If you’ve never even heard the word “NoSQL”, first of all – wow! You are at the end of the blog, and still paying attention. That’s awesome! Second, a quick way to learn about DocumentDB and see it in action is to follow these three steps:
- Watch the two minute What is DocumentDB? video, which introduces the benefits of using DocumentDB.
- Watch the three minute Create DocumentDB on Azure video, which highlights how to get started with DocumentDB by using the Azure Portal.
- Visit the Query Playground, where you can walk through different activities to learn about the rich querying functionality available in DocumentDB. Then, head over to the Sandbox tab and run your own custom SQL queries and experiment with DocumentDB.