Stored Procedure
← Back to DP-420 Terminology Reference
Category: Server-Side Programming
Summary: JavaScript logic executed server-side within a single logical partition transaction.
Overview
A stored procedure in Azure Cosmos DB for NoSQL is a piece of application logic written in JavaScript, registered and executed server-side within the scope of a single logical partition. Stored procedures can perform multiple operations (reads/writes) atomically as a single transaction, making them useful for multi-item transactional logic that transactional batch alone cannot express (e.g., conditional logic across writes).
More Info & Links
DP-420 Style Practice Questions
Q1. In what language are Azure Cosmos DB for NoSQL stored procedures written?
- A. JavaScript
- B. C#
- C. Python
- D. SQL
Q2. What is a key constraint on stored procedure execution scope in Azure Cosmos DB?
- A. They execute within the scope of a single logical partition
- B. They can span multiple containers atomically
- C. They can only read data, never write
- D. They must be triggered by the change feed
Answer Key
Answers are listed at the very end so you can attempt the questions first.
- Q1 (Stored Procedure): A. JavaScript — Stored procedures, triggers, and user-defined functions in Azure Cosmos DB for NoSQL are written in JavaScript.
- Q2 (Stored Procedure): A. They execute within the scope of a single logical partition — Stored procedures operate transactionally within a single logical partition, not across multiple partitions or containers.
DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB — term detail page