Azure Cosmos DB – Change Feed, Stored Procedures and Triggers · AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage

A stored procedure in Azure Cosmos DB must insert three documents and update a fourth document as one atomic operation. What is required for this ope…

Practice question from Azure Cosmos DB – Change Feed, Stored Procedures and Triggers (AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage), with the correct answer and a step-by-step solution.

medium · MCQ · Q-5BC049

A stored procedure in Azure Cosmos DB must insert three documents and update a fourth document as one atomic operation. What is required for this operation to be transactional?

  1. A.All documents must be stored in the same logical partition, and the stored procedure must be executed with that partition key.Correct answer
  2. B.The stored procedure must use a cross-partition query and specify the container's physical partition count.
  3. C.The documents can be in different logical partitions as long as they are in the same Cosmos DB container.
  4. D.The operation must be implemented with a post-trigger because stored procedures cannot provide transactional behavior.

Solution

Cosmos DB stored procedures provide transactional execution only within a single logical partition. The client must supply the corresponding partition key when executing the stored procedure.

More from Azure Cosmos DB – Change Feed, Stored Procedures and Triggers

All of Azure Cosmos DB – Change Feed, Stored Procedures and Triggers

Practise more Develop for Azure Storage

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed