exam questions

Exam DP-420 All Questions

View all questions & answers for the DP-420 exam

Exam DP-420 topic 1 question 10 discussion

Actual exam question from Microsoft's DP-420
Question #: 10
Topic #: 1
[All DP-420 Questions]

HOTSPOT -
You have a container in an Azure Cosmos DB Core (SQL) API 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.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: ConsistencyLevel -
The ItemRequestOptions Class ConsistencyLevel property gets or sets the consistency level required for the request in the Azure Cosmos DB service.
Azure Cosmos DB offers 5 different consistency levels. Strong, Bounded Staleness, Session, Consistent Prefix and Eventual - in order of strongest to weakest consistency.

Box 2: _etag -
The ItemRequestOptions class helped us implement optimistic concurrency by specifying that we wanted the SDK to use the If-Match header to allow the server to decide whether a resource should be updated. The If-Match value is the ETag value to be checked against. If the ETag value matches the server ETag value, the resource is updated.
Reference:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.itemrequestoptions https://cosmosdb.github.io/labs/dotnet/labs/10-concurrency-control.html

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
AT96
Highly Voted 2 years ago
When we then want to send our request to replace a document, we can specify an AccessCondition with the ETag we received when we fetched out our document.
upvoted 23 times
grada
1 year, 10 months ago
This, it's supposed to be either AccessCondition or IfMatchETag directly, consistency levels have nothing to do with optimistic concurrency. https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.client.requestoptions.accesscondition?view=azure-dotnet#examples
upvoted 3 times
...
...
b890yc
Most Recent 7 months, 2 weeks ago
The namespace Microsoft.Azure.Documents.Client is deprecated. So the below link refers to old version of programming API. In other words, using AccessCondition is deprecated. https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.client.requestoptions.accesscondition?view=azure-dotnet#examples The latest namespace is Microsoft.Azure.Cosmos and refer to the following links. https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.container.replaceitemasync https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.itemrequestoptions So the answer will be ConsistencyLevel and _etag.
upvoted 2 times
b890yc
7 months, 2 weeks ago
Apologies, so the answer should be ConsistencyLevel and _id. Consistency level can be mentioned in ItemRequestOptions and _id should be passed to Container.ReplaceItemAsync<T> Method.
upvoted 1 times
...
...
Garyn
7 months, 2 weeks ago
Please correct the answer. it should AccessCondition, and etag.
upvoted 3 times
...
remz
1 year, 9 months ago
Accesscondition ETAG
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago