DP-420 · Question #192
You have an Azure subscription. You plan to create an Azure Cosmos DB for NoSQL database named DB1 that will store author and book data for authors that have each published up to ten books. Typical…
The correct answer is D. Create a single container that stores author items and book items. Embed a list of each author's. To support transactional updates of the author and book data we need to use a single container. Minimize read operations cost: Embed a list of each author’s books in the corresponding author Note: Transactional batch operations in Azure Cosmos DB Transactional batch describes a…
Question
You have an Azure subscription. You plan to create an Azure Cosmos DB for NoSQL database named DB1 that will store author and book data for authors that have each published up to ten books. Typical and frequent queries of the data will include:
- All books written by an individual author
- The synopsis of individual books
You need to recommend a data model for DB1. The solution must meet the following requirements:
- Support transactional updates of the author and book data.
- Minimize read operation costs.
What should you recommend?
Options
- ACreate a single container that stores author items and book items, and then items that represent
- BCreate three containers, one that stores author items, a second that stores book items, and a
- CCreate two containers, one that stores author items and another that stores book items. Embed a
- DCreate a single container that stores author items and book items. Embed a list of each author's
How the community answered
(46 responses)- A15% (7)
- B4% (2)
- C11% (5)
- D70% (32)
Explanation
To support transactional updates of the author and book data we need to use a single container. Minimize read operations cost: Embed a list of each author’s books in the corresponding author Note: Transactional batch operations in Azure Cosmos DB Transactional batch describes a group of point operations that need to either succeed or fail together with the same partition key in a container. Operations are defined, added to the batch, and the batch is executed. If all operations succeed in the order they're described within the transactional batch operation, the transaction will be committed. However, if any operation fails, the entire transaction is rolled back. Does Azure Cosmos DB for NoSQL support ACID (atomicity, consistency, isolation, durability) 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. https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/transactional-batch https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/faq
Topics
Community Discussion
No community discussion yet for this question.