Frequently asked questions about Azure Cosmos DB for NoSQL

APPLIES TO: NoSQL

How do I start developing against Azure Cosmos DB for NoSQL?

First you must sign up for an Azure subscription. Once you sign up for an Azure subscription, you can add an API for NoSQL container to your Azure subscription.

Software development kits (SDKs) are available for .NET, Python, Node.js, JavaScript, Go, and Java. Developers can also use the REST API to interact with Azure Cosmos DB resources from more platforms and languages.

Is there Azure Cosmos DB for NoSQL samples to get started?

Check out these QuickStart code samples and templates for the API for NoSQL:

Does Azure Cosmos DB for NoSQL support schema-free data?

Yes, the API for NoSQL allows applications to store arbitrary JSON documents as items without schema definitions or hints. The data is immediately available for query with the Azure Cosmos DB for NoSQL query language.

Does Azure Cosmos DB for NoSQL support ACID (atomicity, consistency, isolation, durability) transactions?

Yes, the API for NoSQL supports cross-document transactions expressed using either batches in the SDKs or as JavaScript-stored procedures and triggers. Transactions are scoped to a single partition within each container and executed with ACID semantics as "all or nothing," isolated from other concurrently executing code and user requests. If exceptions occur, the entire transaction is rolled back.

How do I create an Azure Cosmos DB for NoSQL database?

You can create databases by using one of these tools:

How do I configure Azure Cosmos DB for NoSQL database-native users and permissions?

You can create users and permissions by using one of the Azure Cosmos DB for NoSQL SDKs or the REST API. For more information, see configure users and resource tokens. Creating permissions by using resource tokens is allowed at the container level and its descendants (such as documents, attachments). Creating a permission at the database or an account level isn't currently allowed.

Can I authenticate to Azure Cosmos DB for NoSQL using my existing Microsoft Entra ID accounts?

Yes! Azure Cosmos DB supports Microsoft Entra authentication to manage the service and its resources (control-plane) and to execute data, operations, and queries (data-plane). Control-plane authentication is performed using the role-based access control feature of Azure. You can use a preconfigured built-in role](../../role-based-access-control/built-in-roles.md) or you can create a custom role. With Azure role-based access control, you can manage accounts, databases, containers, and metadata. The control-plane includes operations including, but not limited to these examples.

  • Creating, replacing, or deleting databases - Creating, replacing, or deleting containers - Reading or replacing database throughput - Reading or replacing container throughput For more information, see Azure Cosmos DB control-plane role-based access control. Data-plane authentication uses a custom API for NoSQL-native role-based access control implementation. With this native implementation, you can also use preconfigured or custom roles. With native role-based access control, you can execute queries, manage items, or perform other common operations. The data-plane includes operations including, but not limited to these examples.
  • Creating, replacing, updating, or deleting items - Patching items - Executing queries For more information, see Azure Cosmos DB data-plane role-based access control.

Does Azure Cosmos DB for NoSQL support the SQL query language?

Structured Query Language (SQL) is a language typically used to query relational data. The API for NoSQL has a custom NoSQL query language derived from SQL. The NoSQL query language includes a subset of the SQL query language typically associated with SQL Server along with various NoSQL-specific enhancements. The NoSQL query language provides rich hierarchical and relational operators and extensibility via JavaScript-based, user-defined functions (UDFs). JSON grammar allows for modeling JSON documents as trees with labeled nodes, which are used by both the Azure Cosmos DB automatic indexing techniques and the SQL query dialect of Azure Cosmos DB. For information about using this query language, see NoSQL Query.

Does Azure Cosmos DB for NoSQL support SQL aggregation functions?

The API for NoSQL supports aggregation via aggregate functions such as: COUNT, MAX, AVG, and SUM via the NoSQL query language.

How does Azure Cosmos DB for NoSQL provide concurrency?

The API for NoSQL supports optimistic concurrency control (OCC) through HTTP entity tags, or ETags. Every API for NoSQL resource has an ETag, and the ETag is set on the server every time a document is updated. The ETag header and the current value are included in all response messages. ETags can be used with the If-Match header to allow the server to decide whether a resource should be updated. The If-Match value is the ETag value to be checked against. If the ETag value matches the server ETag value, the resource is updated. If the ETag is no longer current, the server rejects the operation with an "HTTP 412 Precondition failure" response code. The client then refetches the resource to acquire the current ETag value for the resource. In addition, ETags can be used with the If-None-Match header to determine whether its needed to refetch a resource.

Most of the API for NoSQL SDKs includes classes to manage optimistic concurrency control.

How can I bulk-insert documents into Azure Cosmos DB for NoSQL?

Use the bulk import feature in the .NET SDK or the Java SDK for the API for NoSQL to import large sets of data. This feature optimizes provisioned throughput to import large sets of data.

Alternatively, use Apache Spark to import data at scale using Python or Scala.

Yes, because Azure Cosmos DB for NoSQL is a RESTful service, resource links are immutable and can be cached. API for NoSQL clients can specify an "If-None-Match" header for reads against any resource-like document or container and then update their local copies after the server version changes.

Is a local instance of Azure Cosmos DB for NoSQL available?

Yes. The Azure Cosmos DB emulator provides a high-fidelity emulation of the Azure Cosmos DB service. It supports functionality that's identical to Azure Cosmos DB across various APIs. This functionality includes support for creating items, querying items, provisioning containers, and scaling containers. You can develop and test applications by using the emulator's endpoints. You can then deploy the applications to Azure at a global scale by changing the connection string from the emulator to the live service.

Why are long floating-point values in an Azure Cosmos DB for NoSQL item rounded when using the Data Explorer in the portal?

This Data Explorer limitation is a limitation of JavaScript. JavaScript uses double-precision floating-point format numbers as specified in Institute of Electrical and Electronics Engineers (IEEE) 754. This data type can safely hold numbers between -(253 - 1) and 253-1 (that is, 9007199254740991) only.