You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# How to register and use stored procedures, triggers, and user-defined functions in Azure Cosmos DB
16
16
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
17
17
18
-
The API for NoSQL in Azure Cosmos DB supports registering and invoking stored procedures, triggers, and user-defined functions (UDFs) written in JavaScript. Once you've defined one or more stored procedures, triggers, and user-defined functions, you can load and view them in the [Azure portal](https://portal.azure.com/) by using Data Explorer.
18
+
The API for NoSQL in Azure Cosmos DB supports registering and invoking stored procedures, triggers, and user-defined functions (UDFs) written in JavaScript. After you define one or more stored procedures, triggers, or user-defined functions, you can load and view them in the [Azure portal](https://portal.azure.com/) by using Data Explorer.
19
19
20
-
You can use the API for NoSQL SDK across multiple platforms including [.NET v2 (legacy)](sdk-dotnet-v2.md), [.NET v3](sdk-dotnet-v3.md), [Java](sdk-java-v2.md), [JavaScript](sdk-nodejs.md), or [Python](sdk-python.md) SDKs to perform these tasks. If you haven't worked with one of these SDKs before, see the *"Quickstart"* article for the appropriate SDK:
20
+
You can use the API for NoSQL SDK across multiple platforms including [.NET v2 (legacy)](sdk-dotnet-v2.md), [.NET v3](sdk-dotnet-v3.md), [Java](sdk-java-v2.md), [JavaScript](sdk-nodejs.md), or [Python](sdk-python.md) SDKs to do these tasks. If you haven't worked with one of these SDKs before, see the quickstart article for the appropriate SDK:
21
21
22
22
| SDK | Getting started |
23
23
| :--- | :--- |
24
-
| .NET v3 |[Quickstart: Build a .NET console app to manage Azure Cosmos DB for NoSQL resources](quickstart-dotnet.md)|
24
+
| .NET v3 |[Quickstart: Azure Cosmos DB for NoSQL client library for .NET](quickstart-dotnet.md)|
25
25
| Java | [Quickstart: Build a Java app to manage Azure Cosmos DB for NoSQL data](quickstart-java.md)
26
-
| JavaScript |[Quickstart: Use Node.js to connect and query data from Azure Cosmos DB for NoSQL account](quickstart-nodejs.md)|
27
-
| Python |[Quickstart: Build a Python application using an Azure Cosmos DB for NoSQL account](quickstart-python.md)|
26
+
| JavaScript |[Quickstart: Azure Cosmos DB for NoSQL client library for Node.js](quickstart-nodejs.md)|
27
+
| Python |[Quickstart: Azure Cosmos DB for NoSQL client library for Python](quickstart-python.md)|
28
28
29
29
## How to run stored procedures
30
30
31
-
Stored procedures are written using JavaScript. They can create, update, read, query, and delete items within an Azure Cosmos DB container. For more information on how to write stored procedures in Azure Cosmos DB, see [How to write stored procedures in Azure Cosmos DB](how-to-write-stored-procedures-triggers-udfs.md#stored-procedures) article.
31
+
Stored procedures are written using JavaScript. They can create, update, read, query, and delete items within an Azure Cosmos DB container. For more information, see [How to write stored procedures](how-to-write-stored-procedures-triggers-udfs.md#stored-procedures).
32
32
33
-
The following examples show how to register and call a stored procedure by using the Azure Cosmos DB SDKs. Refer to [Create a Document](how-to-write-stored-procedures-triggers-udfs.md#create-an-item) as the source for this stored procedure is saved as `spCreateToDoItem.js`.
33
+
The following examples show how to register and call a stored procedure by using the Azure Cosmos DB SDKs. For the source for this stored procedure, saved as *spCreateToDoItem.js*, see [Create items using stored procedures](how-to-write-stored-procedures-triggers-udfs.md#create-an-item).
34
34
35
35
> [!NOTE]
36
-
> For partitioned containers, when executing a stored procedure, a partition key value must be provided in the request options. Stored procedures are always scoped to a partition key. Items that have a different partition key value will not be visible to the stored procedure. This also applied to triggers as well.
36
+
> For partitioned containers, when you run a stored procedure, you must provide a partition key value in the request options. Stored procedures are always scoped to a partition key. Items that have a different partition key value aren't visible to the stored procedure. This principle also applies to triggers.
@@ -234,12 +234,12 @@ result = container.scripts.execute_stored_procedure(sproc=created_sproc,params=[
234
234
235
235
## How to run pre-triggers
236
236
237
-
The following examples show how to register and call a pre-trigger by using the Azure Cosmos DB SDKs. Refer to the [Pre-trigger example](how-to-write-stored-procedures-triggers-udfs.md#pre-triggers) as the source for this pre-trigger is saved as `trgPreValidateToDoItemTimestamp.js`.
237
+
The following examples show how to register and call a pre-trigger by using the Azure Cosmos DB SDKs. For the source of this pre-trigger example, saved as *trgPreValidateToDoItemTimestamp.js*, see [Pre-triggers](how-to-write-stored-procedures-triggers-udfs.md#pre-triggers).
238
238
239
-
Pre-triggers are passed in the RequestOptions object, when executing an operation, by specifying `PreTriggerInclude` and then passing the name of the trigger in a List object.
239
+
When you run an operation by specifying `PreTriggerInclude` and then passing the name of the trigger in a `List` object, pre-triggers are passed in the `RequestOptions` object.
240
240
241
241
> [!NOTE]
242
-
> Even though the name of the trigger is passed as a List, you can still execute only one trigger per operation.
242
+
> Even though the name of the trigger is passed as a `List`, you can still run only one trigger per operation.
The following examples show how to register a post-trigger by using the Azure Cosmos DB SDKs. Refer to the [Post-trigger example](how-to-write-stored-procedures-triggers-udfs.md#post-triggers) as the source for this post-trigger is saved as `trgPostUpdateMetadata.js`.
407
+
The following examples show how to register a post-trigger by using the Azure Cosmos DB SDKs. For the source of this post-trigger example, saved as *trgPostUpdateMetadata.js*, see [Post-triggers](how-to-write-stored-procedures-triggers-udfs.md#post-triggers)
The following examples show how to register a user-defined function by using the Azure Cosmos DB SDKs. Refer to this [User-defined function example](how-to-write-stored-procedures-triggers-udfs.md#udfs) as the source for this post-trigger is saved as `udfTax.js`.
568
+
The following examples show how to register a user-defined function by using the Azure Cosmos DB SDKs. For the source of this user-defined function example, saved as *udfTax.js*, see [How to write user-defined functions](how-to-write-stored-procedures-triggers-udfs.md#udfs).
0 commit comments