Skip to content

Commit 982895e

Browse files
committed
Add not about queries from script not seeing updates done by same script transaction
1 parent 55152a5 commit 982895e

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+
> Queries executed from inside stored procedure or trigger may not see document changes done by the same script transaction. The query will only see changes done by the time when script transaction is started. This applies both to SQL queries, such as `getContent().getCollection.queryDocuments()`, and 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)