Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Azure Cosmos DB resource model
In this articleAPPLIES TO: NoSQL MongoDB Cassandra Gremlin TableAzure Cosmos DB is a fully managed platform-as-a-service (PaaS). To begin using Azure Cosmos DB, create an Azure Cosmos DB account in an Azure resource group in your subscription. You then create databases and containers within the account. Your Azure Cosmos DB account contains a unique DNS name and can be managed using the Azure portal, ARM or Bicep templates, Azure PowerShell, Azure CLI, or any of the Azure Management SDK's or REST API. For more information, see how to manage your Azure Cosmos DB account. For replicating your data and throughput across multiple Azure regions, you can add and remove Azure regions to your account at any time. You can configure your account to have either a single region or multiple write regions. For more information, see how to add and remove Azure regions to your account. You can configure the default consistency level on an account. Elements in an Azure Cosmos DB accountCurrently, you can create a maximum of 50 Azure Cosmos DB accounts under an Azure subscription (this is a soft limit that can be increased via support request). A single Azure Cosmos DB account can virtually manage an unlimited amount of data and provisioned throughput. To manage your data and provisioned throughput, you can create one or more databases within your account, then one or more containers to store your data. The following image shows the hierarchy of elements in an Azure Cosmos DB account: The following image shows the hierarchy of different entities in an Azure Cosmos DB account: Azure Cosmos DB databasesIn Azure Cosmos DB, a database is similar to a namespace. A database is simply a group of containers. The following table shows how a database is mapped to various API-specific entities:
Note With API for Table accounts, to maintain compatibility with Azure Storage Tables, tables in Azure Cosmos DB are created at the account level. Azure Cosmos DB containersAn Azure Cosmos DB container is where data is stored. Unlike most relational databases which scale up with larger VM sizes, Azure Cosmos DB scales out. Data is stored on one or more servers, called partitions. To increase throughput or storage, more partitions are added. This provides a virtually an unlimited amount of throughput and storage for a container. When a container is created, you need to supply a partition key. This is a property you select from your documents to store. The value of that property is then used to route data to the partition to be written, updated, or deleted. It can also be used in the WHERE clause in queries for efficient data retrieval. The underlying storage mechanism for data in Azure Cosmos DB is called a physical partition. These can have a throughput amount up to 10,000 RU/s and store up to 50 GB of data. Azure Cosmos DB abstracts this with a logical partition which can store up to 20 GB of data. Logical partitions allow the service to provide greater elasticity and better management of data on the underlying physical partitions as more partitions are added. To learn more about partitioning and partition keys, see Partition data. When you create a container, you configure throughput in one of the following modes:
Note You can not go between dedicated and shared throughput. Containers created in a shared throughput database, cannot be updated to have dedicated throughput. To change a container from shared to dedicated throughput, a new container must be created and data copied to it. Containers are schema-agnostic. Items within a container can have arbitrary schemas or different entities so long as they share the same partition key. For example, an item that represents a customer and one or more items representing all their orders, can be placed in the same container. By default, all data added to a container is automatically indexed without requiring explicit indexing. You can customize the indexing for a container by configuring its indexing policy. You can set Time to Live (TTL) on selected items in a container or for the entire container to silently delete those items automatically in the background with unused throughput to avoid impacting performance. However, even if not deleted, any data that has expired will not appear in any reads made. To learn more, see Configure TTL on your container. Azure Cosmos DB provides a built-in change data capture capability called, change feed that can be used to subscribe to all the changes to data within your container. For more information, see Change feed in Azure Cosmos DB. You can register stored procedures, triggers, user-defined functions (UDFs), and merge procedures for your container. Data within a container must have a unique A container is specialized into API-specific entities as shown in the following table:
Note When creating containers, make sure you don’t create two containers with the same name but different casing. Some parts of the Azure platform are not case-sensitive, and this can result in confusion/collision of telemetry and actions on containers with such names. Properties of an Azure Cosmos DB containerAn Azure Cosmos DB container has a set of system-defined properties. Depending on which API you use, some properties might not be directly exposed. The following table describes the list of system-defined properties:
Azure Cosmos DB itemsDepending on which API you use, data can represent either an item in a container, a document in a collection, a row in a table, or a node or edge in a graph. The following table shows the mapping of API-specific entities to an Azure Cosmos DB item:
Properties of an itemEvery Azure Cosmos DB item has the following system-defined properties. Depending on which API you use, some of them might not be directly exposed.
Note Uniqueness of the Operations on itemsAzure Cosmos DB items support the following operations. You can use any of the Azure Cosmos DB APIs to perform the operations.
Next stepsLearn how to manage your Azure Cosmos DB account and other concepts:
FeedbackSubmit and view feedback for What is a collection of entities that share common properties or characteristics?An entity Type is defined as a collection of entities, which share a common definition in terms of their attributes. Each entity type is assigned a name for its subsequent identification. The values of attributes of an entity belonging to entity type are known as Entity Instance.
What are characteristics or properties of an entity called?Attribute. A characteristic or trait of an entity type that describes the entity, for example, the Person entity type has the Date of Birth attribute.
What is a collection of similar entities?An entity type (or entity set) is a collection of similar entities, e.g., a collection of people.
What is a term used to describe the relationship between two entities?An entity–relationship model (or ER model) describes interrelated things of interest in a specific domain of knowledge. A basic ER model is composed of entity types (which classify the things of interest) and specifies relationships that can exist between entities (instances of those entity types).
|