2
2
title : Azure Cosmos DB trigger for Functions 2.x and higher
3
3
description : Learn to use the Azure Cosmos DB trigger in Azure Functions.
4
4
ms.topic : reference
5
- ms.date : 11/29/2022
5
+ ms.date : 03/03/2023
6
6
ms.devlang : csharp, java, javascript, powershell, python
7
7
ms.custom : devx-track-csharp, devx-track-python, ignite-2022
8
8
zone_pivot_groups : programming-languages-set-functions-lang-workers
@@ -77,9 +77,10 @@ Apps using [Azure Cosmos DB extension version 4.x](./functions-bindings-cosmosdb
77
77
``` cs
78
78
namespace CosmosDBSamplesV2
79
79
{
80
+ // Customize the model with your own desired properties
80
81
public class ToDoItem
81
82
{
82
- public string Id { get ; set ; }
83
+ public string id { get ; set ; }
83
84
public string Description { get ; set ; }
84
85
}
85
86
}
@@ -106,7 +107,7 @@ namespace CosmosDBSamplesV2
106
107
if (input != null && input .Count > 0 )
107
108
{
108
109
log .LogInformation (" Documents modified " + input .Count );
109
- log .LogInformation (" First document Id " + input [0 ].Id );
110
+ log .LogInformation (" First document Id " + input [0 ].id );
110
111
}
111
112
}
112
113
}
@@ -186,17 +187,21 @@ Here's the binding data in the *function.json* file:
186
187
Here's the C# script code:
187
188
188
189
``` cs
189
- #r "Microsoft.Azure.DocumentDB.Core"
190
-
191
190
using System ;
192
- using Microsoft .Azure .Documents ;
193
191
using System .Collections .Generic ;
194
192
using Microsoft .Extensions .Logging ;
195
193
196
- public static void Run (IReadOnlyList < Document > documents , ILogger log )
194
+ // Customize the model with your own desired properties
195
+ public class ToDoItem
196
+ {
197
+ public string id { get ; set ; }
198
+ public string Description { get ; set ; }
199
+ }
200
+
201
+ public static void Run (IReadOnlyList < ToDoItem > documents , ILogger log )
197
202
{
198
203
log .LogInformation (" Documents modified " + documents .Count );
199
- log .LogInformation (" First document Id " + documents [0 ].Id );
204
+ log .LogInformation (" First document Id " + documents [0 ].id );
200
205
}
201
206
```
202
207
0 commit comments