nerdexam
Microsoft

DP-420 · Question #70

You have a container in an Azure Cosmos DB for NoSQL account. The container stores data about families. Data about parents, children, and pets are stored as separate documents. Each document…

The correct answer is C. Update the document of each family member by using a transactional batch operation. The correct answer is C: Update the documents using a transactional batch operation. Azure Cosmos DB's transactional batch API allows multiple operations (reads, writes, patches, deletes) targeting the same logical partition key to execute as a single ACID transaction. Since…

Optimize an Azure Cosmos DB solution

Question

You have a container in an Azure Cosmos DB for NoSQL account. The container stores data about families. Data about parents, children, and pets are stored as separate documents. Each document contains the address of each family. Members of the same family share the same partition key named familyId. You need to update the address for each member of the same family that share the same address. The solution must meet the following requirements:

  • Be atomic, consistent, isolated, and durable (ACID).
  • Provide the lowest latency.

What should you do?

Options

  • AUpdate the document of each family member separately by using a patch operation
  • BUpdate the document of each family member separately and set the consistency level to strong
  • CUpdate the document of each family member by using a transactional batch operation

How the community answered

(55 responses)
  • A
    9% (5)
  • B
    15% (8)
  • C
    76% (42)

Explanation

The correct answer is C: Update the documents using a transactional batch operation. Azure Cosmos DB's transactional batch API allows multiple operations (reads, writes, patches, deletes) targeting the same logical partition key to execute as a single ACID transaction. Since all family members share the same familyId partition key, all their documents reside in the same logical partition, making them eligible for a transactional batch. This satisfies the ACID requirement in a single round-trip, which provides the lowest possible latency. Option A (separate patch operations) does not guarantee atomicity across multiple documents. Option B (separate operations with strong consistency) ensures consistent reads but does not make the multi-document write atomic - if one update fails, the others are not rolled back.

Topics

#Transactional Batch#ACID Properties#Partitioning#Latency Optimization

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice