Guest User

Untitled

a guest
Nov 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using Microsoft.Azure.Documents;
  3. using Microsoft.Azure.WebJobs;
  4. using Microsoft.Azure.WebJobs.Host;
  5. using Microsoft.Extensions.Logging;
  6.  
  7. namespace Company.Function
  8. {
  9. public static class CosmosDBTriggerCSharp
  10. {
  11. [FunctionName("CosmosDBTriggerCSharp")]
  12. public static void Run(
  13. [CosmosDBTrigger(
  14. databaseName: "mydatabase",
  15. collectionName: "mycollection",
  16. ConnectionStringSetting = "MyCosmosDB")]IReadOnlyList<Document> input,
  17. ILogger log)
  18. {
  19. if (input != null && input.Count > 0)
  20. {
  21. log.LogInformation("Documents modified " + input.Count);
  22. log.LogInformation("First document text " + input[0].GetPropertyValue<string>("text"));
  23. }
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment