Azure DocumentDB – CRUD Operations

Started playing around with Azure DocumentDB, and I am pretty excited about it. The simplicity is just crazy. Most of the application out there need CRUD operations, So I thought I will try to compile them in 1 post for quick reference.

  • To begin with you need to create a DocumentDB database account. The below link walks through that.

  • Next step is to create DocumentDB collections, which will hold our documents.
  • Next step is to add documents into the collections. Following link explains how to add, view documents using the document explorer, we will look how to do them using the sdk.
  • Next step is to get the DocumentDB client library package to start coding against Azure DocumentDB.

  • Next create a DocumentClient , from which we will execute all our CRUD operations.

You can find the DocumentDB URI and primary key from the azure portal.


  •  Once we have a DocumentClient we are ready to work with collections. To work with collections we need to get the collection link, the easiest way to find the selflink for the collection is to use a tool called DocumentDB Studio .


Copy the selflink as part of your configuration.

As application developer we work with entities and objects and their json serialized formats, Azure DocumentDB is designed from the ground up to natively support JSON and JavaScript directly inside the database engine, which makes application development much more agile.  You can download the simple console application here which covers all the basic CRUD operations on Azure  DocumentDB. Also for quick reference, below is the code.

  •  Resources

Leave a Reply

Your email address will not be published. Required fields are marked *