You are designing an Azure Cosmos DB container to store reservation records for a hotel management system. Each reservation includes the fields `hotelId`, `guestId`, `reservationDate`, and `status`. You need to configure the container to support multi-document transactional batches for reservations at the same hotel, while avoiding hot partitions.
Which two configuration choices should you make? (Select two.)
- Set the partition key of the container to `/hotelId`Answer
- Ensure that all operations within a single transactional batch specify the same `/hotelId` valueAnswer
- CSet the partition key of the container to `/status` to group reservations by their current state
- DExecute transactional batch operations across different `/hotelId` values to update multiple hotels in one transaction
Answer
Configure the container with `/hotelId` as the partition key and ensure all operations in a transactional batch target the same `/hotelId` value.
To support transactional batches for reservations at the same hotel, the container must be partitioned by `/hotelId` so that all reservations for a given hotel reside in the same logical partition. Furthermore, all operations within a transactional batch must target this same partition key value, as transactional batches cannot span multiple logical partitions.
Step-by-Step Solution
Key Concept
Azure Cosmos DB partition keys must be chosen to align with transactional boundaries (which are limited to a single logical partition) while avoiding hot partitions by ensuring sufficient cardinality.
Estimated Time:1m 0s