Skip to content

asthana86/DocumentDBCpp

 
 

Repository files navigation

DocumentDBCpp

Introduction

DocumentDBCpp is C++ wrapper and object model for DocumentDB NoSQL database. It is built on top of C++ REST SDK framework, so all the goodies like Task Parallelism are included. There is no other dependencies except C++ REST SDK.

Usage

	// Start by defining your account's configuration
	DocumentDBConfiguration conf (L"https://<account>.documents.azure.com", L"<primary_key>");
	// Create your client
	DocumentClient client (conf);
	// Create a new database
	shared_ptr<Database> db = client.CreateDatabase (L"db");
	// Create a collection inside database
	shared_ptr<Collection> coll = db->CreateCollection (L"coll");
	// Insert a document
	web::json::value doc;
	doc[L"foo"] = web::json::value::string (L"bar");
	coll->CreateDocument (doc);
	// All of the above is also supported in async fashion
	coll->CreateDocumentAsync (doc).then ([=](shared_ptr<Document> doc)
	{
		wcout << L"Asynchronously done inserting document";
	});

For complete set of supported methods, look at test.cpp and/or browse a code.

Testing

Test your new changes by running Test.exe. Couple of notes before you fire it up:

  1. No support currently for proper unit testing
  2. Note that you will have to put your own account in test.cpp on which tests will be run against
  3. There is no automatic cleanup if tests are failing, so you will need to clean up after yourself
  4. Tests are not accessing other databases in your account, nor deleting anything, but anyway...be careful

Backlog

  1. Extend object model with users, triggers, UDFs, conflicts and the rest of supported DocumentDB entities
  2. Support for TCP protocol
  3. Support working with secondary keys
  4. Support Linux and all other platforms where C++ REST SDK is supported
  5. Support x64
  6. Support v140 toolset

About

C++ wrapper and object model for DocumentDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.2%
  • C 2.8%