Created
November 21, 2018 19:08
-
-
Save vainolo/2c410f5aaee7b3dc14e5e415693e8251 to your computer and use it in GitHub Desktop.
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using Microsoft.Azure.Documents; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Host; | |
using Microsoft.Extensions.Logging; | |
namespace Company.Function | |
{ | |
public static class CosmosDBTriggerCSharp | |
{ | |
[FunctionName("CosmosDBTriggerCSharp")] | |
public static void Run( | |
[CosmosDBTrigger( | |
databaseName: "mydatabase", | |
collectionName: "mycollection", | |
ConnectionStringSetting = "MyCosmosDB")]IReadOnlyList<Document> input, | |
ILogger log) | |
{ | |
if (input != null && input.Count > 0) | |
{ | |
log.LogInformation("Documents modified " + input.Count); | |
log.LogInformation("First document text " + input[0].GetPropertyValue<string>("text")); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment