0% found this document useful (0 votes)
69 views

Mongo API

Azure Cosmos DB is a globally distributed database that offers low latency and high availability through service level agreements. It supports multiple APIs including Core (SQL), MongoDB, Cassandra, Azure Table, and Gremlin APIs. The Core (SQL) API is the default and provides a document data model with SQL-like querying. The other APIs allow using existing clients by emulating their interfaces but storing data in Azure Cosmos DB's multi-model format under the hood. The best API choice depends on factors like data schema flexibility needs, relationship metadata requirements, and data structure.

Uploaded by

Saravanan Kvk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Mongo API

Azure Cosmos DB is a globally distributed database that offers low latency and high availability through service level agreements. It supports multiple APIs including Core (SQL), MongoDB, Cassandra, Azure Table, and Gremlin APIs. The Core (SQL) API is the default and provides a document data model with SQL-like querying. The other APIs allow using existing clients by emulating their interfaces but storing data in Azure Cosmos DB's multi-model format under the hood. The best API choice depends on factors like data schema flexibility needs, relationship metadata requirements, and data structure.

Uploaded by

Saravanan Kvk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Choose the appropriate API for Azure

Cosmos DB
Azure Cosmos DB is a globally distributed and elastically scalable database. It has a guaranteed low latency
that is backed by a comprehensive set of Service Level Agreements (SLAs). Consistency can sometimes be an
issue when you are working with distributed systems, but Azure Cosmos DB alleviates this situation by offering
you five different consistency levels: strong, bounded staleness, session, consistent prefix, and eventual.

All of the above is supported by a multi-model Azure Cosmos DB's approach, which provides you with the
ability to use document, key-value, wide-column, or graph-based data.

The final choice you have is how to access and manipulate your data. Azure Cosmos DB was built to support
multiple different models, and you can continue to use industry standard APIs if they are already part of your
application or database design.

This flexibility means that Azure Cosmos DB can be used as the database in all of the components that are
being designed for your project.

In this unit you'll discover, at a High Level, what each of the API choices are, and how they might be used. In
the following units, you'll see scenarios where each of the API choices will be applicable.

Core (SQL) API

Core (SQL) is the default API for Azure Cosmos DB, which provides you with a view of your data that resembles
a traditional NoSQL document store. You can query the hierarchical JSON documents with a SQL-like language.
Core (SQL) uses JavaScript's type system, expression evaluation, and function invocation.

MongoDB API

Azure Cosmos DB's API for MongoDB supports the MongoDB wire protocol. This API allows existing MongoDB
client SDKs, drivers, and tools to interact with the data transparently, as if they are running against an actual
MongoDB database. The data is stored in document format, which is the same as using Core (SQL). Azure
Cosmos DB's API for MongoDB is currently compatible with 3.2 version of the MongoDB wire protocol.

Cassandra API

Azure Cosmos DB's support for the Cassandra API makes it possible to query data by using the Cassandra
Query Language (CQL), and your data will appear to be a partitioned row store. Just like the MongoDB API, any
clients or tools should be able to connect transparently to Azure Cosmos DB; only your connection settings
should need to be updated. Cosmos DB's Cassandra API currently supports version 4 of the CQL wire protocol.

Azure Table API

Azure Cosmos DB's Azure Table API provides support for applications that are written for Azure Table Storage
that need premium capabilities like global distribution, high availability, scalable throughput. The original Table
API only allows for indexing on the Partition and Row keys; there are no secondary indexes. Storing table data
in Cosmos DB automatically indexes all the properties, and requires no index management.
Gremlin (graph) API

Choosing Gremlin as the API provides a graph-based view over the data. Remember that at the lowest level, all
data in any Azure Cosmos DB is stored in an ARS format. A graph-based view on the database means data is
either a vertex (which is an individual item in the database), or an edge (which is a relationship between items
in the database).

Define the scenario where the database is going to be used:

1. Does the schema change a lot?


o A traditional document database is a good fit in these scenarios, making Core (SQL) a good
choice.
2. Is there important data about the relationships between items in the database?
o Relationships that require metadata to be stored for them are best represented in a graph
database.
3. Does the data consist of simple key-value pairs?
o Before Azure Cosmos DB existed, Redis or the Table API might have been a good fit for this
kind of data; however, Core (SQL) API is now the better choice, as it offers a richer query experience,
with improved indexing over the Table API.

References:
https://docs.microsoft.com/en-us/learn/modules/choose-api-for-cosmos-db/

You might also like