What is Azure Cosmos DB?
Azure Cosmos DB is a globally distributed, multi-model database service. It offers turnkey global distribution, guarantees single-digit millisecond latencies at the 99th percentile, elastic scaling of throughput and storage, and comprehensive SLA’s.
New object model
Based on your feedback, we’ve redesigned the object model to make it easier to interact with and perform operations against Cosmos DB.
We’ve created a new top level CosmosClient class to replace DocumentDBClient, and split up its methods into modular Database, Container, and Items classes. This new API surface enables a “builder” or “fluent” pattern. For example, to create an item, we first reference its database and container, and call items.create(). This removes the need to build an explicit URL to reference a resource.
As a result, you can create a new database, container, and add an item in only 10 lines of code!
In addition, because Azure Cosmos DB supports multiple API models, we’ve introduced the concept of Container and Item into the SDK, to replace the previous Collection and Document concepts. What was previously known as a “Collection” is now called a “Container.”
We’ve added full support for promises so you no longer have to write custom code to wrap the SDK yourself. Now, you can use async/await by awaiting the calls to Azure Cosmos DB directly from inside an async function.
We’ve also added a convenience method createIfNotExists() for databases and containers, which wraps the logic to read the database, check the status code, and create it if it doesn’t exist.
Multi-region writes support
With Azure Cosmos DB multi-region writes, developers can build globally distributed apps that can read and write data to any Azure region in the world. To use the new SDK with multi-region writes, get started with samples.
Open Source model