Azure Cosmos DB is a multi-model database that supports various data models, such as documents,
key-value, graph, and column-family3. The core content-model of Cosmos DB’s database engine is
based on atom-record-sequence (ARS), which allows it to store and query different types of data in a
flexible and efficient way3.
To develop a model that supports order read operations and minimizes the number of requests, you
should consider the following factors:
The size and shape of your data
The frequency and complexity of your queries
The latency and throughput requirements of your application
The trade-offs between storage efficiency and query performance
Based on these factors, one possible model that you could implement is B. Create a single database
that contains one container. Create a separate document for each order and embed the order items
into the order documents.
This model has the following advantages:
It stores orders and order items as self-contained documents that can be easily retrieved by order
ID1.
It avoids storing redundant data or creating additional containers for order items1.
It allows you to view the order history of a customer with simple queries1.
It leverages the benefits of embedding data, such as reducing the number of requests, improving
query performance, and simplifying data consistency2.
This model also has some limitations, such as:
It may not be suitable for some order items that have data that is greater than 2 KB, as it could
exceed the maximum document size limit of 2 MB2.
It may not be optimal for scenarios where order items need to be queried independently from orders
or aggregated by other criteria2.
It may not support transactions across multiple orders or customers, as transactions are scoped to a
single logical partition2.
Depending on your specific use case and requirements, you may need to adjust this model or choose
a different one. For example, you could use a hybrid data model that combines embedding and
referencing data2, or you could use a graph data model that expresses entities and relationships as
vertices and edges.