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?
- A.All documents must be stored in the same logical partition, and the stored procedure must be executed with that partition key.Correct answer
- B.The stored procedure must use a cross-partition query and specify the container's physical partition count.
- C.The documents can be in different logical partitions as long as they are in the same Cosmos DB container.
- 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
- A .NET service must process new and updated documents from an Azure Cosmos DB container, while allowing multiple service instances to scale…
- An application has a Cosmos DB pre-trigger named ValidateOrder. The developer expects the trigger to run automatically whenever any client…
- A Cosmos DB container uses customerId as its partition key. A change feed consumer receives changes for customers C100 and C200. Which orde…
- An application uses the default latest-version mode of the Azure Cosmos DB change feed. It must reliably notify another system when a custo…
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 freeFree to start · No credit card needed