nerdexam
Microsoft

DP-420 · Question #142

You plan to create an Azure Cosmos DB for NoSQL database named db1 that will contain two containers. One of the containers will contain blog posts, and the other will contain users. Each item in the…

The correct answer is B. a change feed processor. To automatically update denormalized data in one container based on changes in another, an Azure Cosmos DB change feed processor is the appropriate mechanism.

Integrate an Azure Cosmos DB solution

Question

You plan to create an Azure Cosmos DB for NoSQL database named db1 that will contain two containers. One of the containers will contain blog posts, and the other will contain users. Each item in the blog post container will include:

  • A single blog post
  • The top 10 comments associated to the blog post
  • The names of the users who created the blog post and the associated

comments You need to automatically update the usernames in the blog post container whenever a username in the user container changes. What should you implement for the user container?

Options

  • Aa stored procedure
  • Ba change feed processor
  • Ca post-trigger
  • Da user-defined function (UDF)

How the community answered

(50 responses)
  • A
    10% (5)
  • B
    84% (42)
  • C
    2% (1)
  • D
    4% (2)

Why each option

To automatically update denormalized data in one container based on changes in another, an Azure Cosmos DB change feed processor is the appropriate mechanism.

Aa stored procedure

Stored procedures execute transactional operations within a single partition on a Cosmos DB container, typically for complex atomic operations, but are not designed for reacting to changes across containers or replicating data.

Ba change feed processorCorrect

A change feed processor is designed to listen for changes in an Azure Cosmos DB container and react to them in near real-time. By implementing a change feed processor on the user container, you can detect when a username changes and then use that information to update the corresponding usernames in the blog post container, ensuring data consistency across denormalized data.

Ca post-trigger

Post-triggers execute after an item operation (insert, replace, delete) on the same item within the same container and are not suitable for reacting to changes in a different container to update another.

Da user-defined function (UDF)

User-defined functions (UDFs) are used within Cosmos DB SQL queries to extend query language capabilities or perform custom logic during query execution, not for reacting to data changes across containers.

Concept tested: Cosmos DB change feed for denormalization

Source: https://learn.microsoft.com/azure/cosmos-db/change-feed-processor

Topics

#Change Feed#Data Synchronization#Cross-container operations#Event-driven architecture

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice