Microsoft

DP-420 practice question 9

Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB · free question 9 of 20

Question

You have a container in an Azure Cosmos DB for NoSQL account. You need to use the Azure Cosmos DB SDK to replace a document by using optimistic concurrency. What should you include in the code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Explanation

RequestOptions property to set: AccessCondition, set to an IfMatch condition carrying the ETag read earlier, makes the replace conditional; in the .NET SDK v3 the equivalent is ItemRequestOptions.IfMatchEtag. ConsistencyLevel and SessionToken control read guarantees, not whether a write is rejected when the item has changed. Document property that will be compared: _etag is the system property the server regenerates on every update and compares with the if-match header; when they differ the replace fails with HTTP 412 Precondition Failed. The id and _rid identify the item but do not change when it is updated, so they cannot detect a concurrent change.

Need the theory? Learn it free in the DP-420 course on Godlike Academy

Practice the whole free set

Answer all 20 free DP-420 questions with instant feedback, or unlock all 211 questions with Learn and Exam modes.