Microsoft

DP-420 practice question 4

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

Question

You have a database in an Azure Cosmos DB for NoSQL account. You plan to create a container that will store employee data for 5,000 small businesses. Each business will have up to 25 employees. Each employee item will have an emailAddress value. You need to ensure that the emailAddress value for each employee within the same company is unique. To what should you set the partition key and the unique key? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Explanation

Partition key: companyId. A unique key constraint is enforced only within a logical partition, so partitioning by companyId puts all employees of one company together, and 5,000 companies with up to 25 employees each give many small, evenly sized logical partitions. Using emailAddress, companyId+emailAddress or employeeId would give every employee its own logical partition, so a unique key could never compare addresses across one company. Unique key: emailAddress. With companyId as the partition key, a unique key on /emailAddress guarantees that no two items in the same company share an email address, while the same address can still exist in a different company. A unique key on companyId would allow only one employee per company, and employeeId does not address the requirement.

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.