A Cosmos DB item was read with an ETag. How do you implement optimistic concurrency control?
- A Use a stored procedure
- B Use If-Match header with the ETag on the update request (correct answer)
- C Use partition key locking
- D Use transaction batch with read-first
Shortcut: Cosmos DB supports optimistic concurrency via ETags. Include the If-Match header with the item's ETag on updates; if the item was modified since, Cosmos DB returns 412 Precondition Failed.