You are developing a C# backend service for a multi-tenant SaaS document editor. The Azure Cosmos DB container contains document metadata and is configured with Session consistency. The container's partition key is `/tenantId`.
Initially, the development team considered partitioning the container by a status field, `/isArchived`, but chose `/tenantId` to avoid hot partitions.
A user reports that when they modify a document on one device, the updated metadata is not immediately visible when they open the application on another device (which runs in a separate client session). You capture the session token from the write operation's response on the first device as `capturedSessionToken`.
You need to perform a point read on the second device to guarantee that the user reads the latest update.
Which C# code segment should you use?
- ItemRequestOptions options = new ItemRequestOptions { SessionToken = capturedSessionToken };
ItemResponse<DocumentMetadata> response = await container.ReadItemAsync<DocumentMetadata>(
documentId,
new PartitionKey(tenantId),
options
);Answer - BItemResponse<DocumentMetadata> response = await container.ReadItemAsync<DocumentMetadata>(
documentId,
new PartitionKey(tenantId)
); - CItemRequestOptions options = new ItemRequestOptions { SessionToken = capturedSessionToken };
ItemResponse<DocumentMetadata> response = await container.ReadItemAsync<DocumentMetadata>(
documentId,
new PartitionKey(isArchived),
options
); - DRequestOptions options = new RequestOptions { SessionToken = capturedSessionToken };
var response = await client.ReadDocumentAsync<DocumentMetadata>(
UriFactory.CreateDocumentUri("DatabaseId", "ContainerId", documentId),
new RequestOptions { PartitionKey = new Microsoft.Azure.Documents.PartitionKey(tenantId), SessionToken = capturedSessionToken }
);
Answer
ItemResponse<DocumentMetadata> response = await container.ReadItemAsync<DocumentMetadata>(
documentId,
new PartitionKey(tenantId),
options
);