Skip to content

Commit ce0df0c

Browse files
committed
Copy edit
1 parent aaf42e4 commit ce0df0c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

articles/cosmos-db/nosql/how-to-use-stored-procedures-triggers-udfs.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
2-
title: Register and use stored procedures, triggers, and user-defined functions in Azure Cosmos DB SDKs
2+
title: Use stored procedures, triggers, and UDFs in SDKs
3+
titleSuffix: Azure Cosmos DB
34
description: Learn how to register and call stored procedures, triggers, and user-defined functions using the Azure Cosmos DB SDKs.
45
author: seesharprun
56
ms.service: cosmos-db
67
ms.subservice: nosql
7-
ms.topic: how-to
8-
ms.date: 03/09/2023
8+
ms.topic: conceptual
9+
ms.date: 03/16/2023
910
ms.author: sidandrews
1011
ms.reviewer: jucocchi
1112
ms.devlang: csharp, java, javascript, python
1213
ms.custom: devx-track-python, devx-track-js, devx-track-csharp
1314
---
1415

1516
# How to register and use stored procedures, triggers, and user-defined functions in Azure Cosmos DB
17+
1618
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
1719

1820
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.
@@ -22,7 +24,7 @@ You can use the API for NoSQL SDK across multiple platforms including [.NET v2 (
2224
| SDK | Getting started |
2325
| :--- | :--- |
2426
| .NET v3 | [Quickstart: Azure Cosmos DB for NoSQL client library for .NET](quickstart-dotnet.md) |
25-
| Java | [Quickstart: Build a Java app to manage Azure Cosmos DB for NoSQL data](quickstart-java.md)
27+
| Java | [Quickstart: Build a Java app to manage Azure Cosmos DB for NoSQL data](quickstart-java.md) |
2628
| JavaScript | [Quickstart: Azure Cosmos DB for NoSQL client library for Node.js](quickstart-nodejs.md) |
2729
| Python | [Quickstart: Azure Cosmos DB for NoSQL client library for Python](quickstart-python.md) |
2830

@@ -235,18 +237,18 @@ result = container.scripts.execute_stored_procedure(sproc=created_sproc,params=[
235237

236238
---
237239

238-
## How to run pre-triggers
240+
## How to run pretriggers
239241

240-
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).
242+
The following examples show how to register and call a pretrigger by using the Azure Cosmos DB SDKs. For the source of this pretrigger example, saved as *trgPreValidateToDoItemTimestamp.js*, see [Pretriggers](how-to-write-stored-procedures-triggers-udfs.md#pre-triggers).
241243

242-
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.
244+
When you run an operation by specifying `PreTriggerInclude` and then passing the name of the trigger in a `List` object, pretriggers are passed in the `RequestOptions` object.
243245

244246
> [!NOTE]
245247
> Even though the name of the trigger is passed as a `List`, you can still run only one trigger per operation.
246248
247249
### [.NET SDK v2](#tab/dotnet-sdk-v2)
248250

249-
The following code shows how to register a pre-trigger using the .NET SDK v2:
251+
The following code shows how to register a pretrigger using the .NET SDK v2:
250252

251253
```csharp
252254
string triggerId = "trgPreValidateToDoItemTimestamp";
@@ -261,7 +263,7 @@ Uri containerUri = UriFactory.CreateDocumentCollectionUri("myDatabase", "myConta
261263
await client.CreateTriggerAsync(containerUri, trigger);
262264
```
263265

264-
The following code shows how to call a pre-trigger using the .NET SDK v2:
266+
The following code shows how to call a pretrigger using the .NET SDK v2:
265267

266268
```csharp
267269
dynamic newItem = new
@@ -279,7 +281,7 @@ await client.CreateDocumentAsync(containerUri, newItem, requestOptions);
279281

280282
### [.NET SDK v3](#tab/dotnet-sdk-v3)
281283

282-
The following code shows how to register a pre-trigger using the .NET SDK v3:
284+
The following code shows how to register a pretrigger using the .NET SDK v3:
283285

284286
```csharp
285287
await client.GetContainer("database", "container").Scripts.CreateTriggerAsync(new TriggerProperties
@@ -291,7 +293,7 @@ await client.GetContainer("database", "container").Scripts.CreateTriggerAsync(ne
291293
});
292294
```
293295

294-
The following code shows how to call a pre-trigger using the .NET SDK v3:
296+
The following code shows how to call a pretrigger using the .NET SDK v3:
295297

296298
```csharp
297299
dynamic newItem = new
@@ -307,7 +309,7 @@ await client.GetContainer("database", "container").CreateItemAsync(newItem, null
307309

308310
### [Java SDK](#tab/java-sdk)
309311

310-
The following code shows how to register a pre-trigger using the Java SDK:
312+
The following code shows how to register a pretrigger using the Java SDK:
311313

312314
```java
313315
CosmosTriggerProperties definition = new CosmosTriggerProperties(
@@ -322,7 +324,7 @@ CosmosTriggerResponse response = container
322324
.createTrigger(definition);
323325
```
324326

325-
The following code shows how to call a pre-trigger using the Java SDK:
327+
The following code shows how to call a pretrigger using the Java SDK:
326328

327329
```java
328330
ToDoItem item = new ToDoItem();
@@ -341,7 +343,7 @@ CosmosItemResponse<ToDoItem> response = container.createItem(item, options);
341343

342344
### [JavaScript SDK](#tab/javascript-sdk)
343345

344-
The following code shows how to register a pre-trigger using the JavaScript SDK:
346+
The following code shows how to register a pretrigger using the JavaScript SDK:
345347

346348
```javascript
347349
const container = client.database("myDatabase").container("myContainer");
@@ -354,7 +356,7 @@ await container.scripts.triggers.create({
354356
});
355357
```
356358

357-
The following code shows how to call a pre-trigger using the JavaScript SDK:
359+
The following code shows how to call a pretrigger using the JavaScript SDK:
358360

359361
```javascript
360362
const container = client.database("myDatabase").container("myContainer");
@@ -369,7 +371,7 @@ await container.items.create({
369371

370372
### [Python SDK](#tab/python-sdk)
371373

372-
The following code shows how to register a pre-trigger using the Python SDK:
374+
The following code shows how to register a pretrigger using the Python SDK:
373375

374376
```python
375377
import azure.cosmos.cosmos_client as cosmos_client
@@ -395,7 +397,7 @@ container = database.get_container_client(container_name)
395397
trigger = container.scripts.create_trigger(trigger_definition)
396398
```
397399

398-
The following code shows how to call a pre-trigger using the Python SDK:
400+
The following code shows how to call a pretrigger using the Python SDK:
399401

400402
```python
401403
item = {'category': 'Personal', 'name': 'Groceries',

0 commit comments

Comments
 (0)