nerdexam
Microsoft

DP-420 · Question #76

You plan to store order data in an Azure Cosmos DB for NoSQL account. The data contains information about orders and their associated items. You need to develop a model that supports read operations…

The correct answer is D. Create a single database that contains one container. Create a separate document for each order. The correct answer is D: Create a single database with one container, and create one document per order that embeds the order items within it. In Azure Cosmos DB, retrieving related data with a single point read requires co-locating that data in a single document. Because order…

Design and implement data models

Question

You plan to store order data in an Azure Cosmos DB for NoSQL account. The data contains information about orders and their associated items. You need to develop a model that supports read operations for orders. The solution must minimize the number of requests. What should you do?

Options

  • ACreate a database for orders and a database for order items.
  • BCreate a single database that contains a container for orders and a container for order items.
  • CCreate a single database that contains one container. Store orders and order items in separate
  • DCreate a single database that contains one container. Create a separate document for each order

How the community answered

(26 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    8% (2)
  • D
    85% (22)

Explanation

The correct answer is D: Create a single database with one container, and create one document per order that embeds the order items within it. In Azure Cosmos DB, retrieving related data with a single point read requires co-locating that data in a single document. Because order items are always accessed alongside their parent order and the relationship is one-to-many (one order, many items), embedding the items array directly into the order document allows each order retrieval to be a single low-latency, low-RU point read. Options A and B split orders and items into separate databases or containers, requiring multiple requests or cross-partition queries. Option C stores orders and items as separate documents in the same container, which still requires multiple reads or a query to join them at read time.

Topics

#Data modeling#NoSQL#Denormalization#Read optimization

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice