Skip to content

Commit 2cb2f66

Browse files
authored
Merge pull request #112933 from mkolt/users/mkolt/SprocQuery
Add note: queries from script not seeing updates done by same script transaction
2 parents 509ffab + 2537ae5 commit 2cb2f66

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

articles/cosmos-db/stored-procedures-triggers-udfs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Transactions are natively integrated into the Azure Cosmos DB JavaScript program
6161

6262
Stored procedures and triggers are always executed on the primary replica of an Azure Cosmos container. This feature ensures that reads from stored procedures offer [strong consistency](consistency-levels-tradeoffs.md). Queries using user-defined functions can be executed on the primary or any secondary replica. Stored procedures and triggers are intended to support transactional writes – meanwhile read-only logic is best implemented as application-side logic and queries using the [Azure Cosmos DB SQL API SDKs](sql-api-dotnet-samples.md), will help you saturate the database throughput.
6363

64+
> [!TIP]
65+
> The queries executed within a stored procedure or trigger may not see changes to items made by the same script transaction. This statement applies both to SQL queries, such as `getContent().getCollection.queryDocuments()`, as well as integrated language queries, such as `getContext().getCollection().filter()`.
66+
6467
## Bounded execution
6568

6669
All Azure Cosmos DB operations must complete within the specified timeout duration. This constraint applies to JavaScript functions - stored procedures, triggers, and user-defined functions. If an operation does not complete within that time limit, the transaction is rolled back.

0 commit comments

Comments
 (0)