0
votes

Azure function app with HTTP trigger and 2 DocumentDB bindings - in and out.
On this page there are nice examples of how to add a new document, get existing one and update it. However - no examples on how to delete one!
Is a delete of an existing document possible at all with output bindings? And if not, what would be the best alternative - using Azure SDK within the function?
Thanks.

1

1 Answers

0
votes

Yes, to delete a document you have to write an Azure function...here is the pcode if you are using the changefeed.

#r "Microsoft.Azure.Documents.Client"
using Microsoft.Azure.Documents;
using System.Collections.Generic;
using System;
public static void Run(IReadOnlyList<Document> documents, TraceWriter log)
{
     //Get the document Id documents[0].Id);
     //set the Request option
     call DeleteDocumentAsync(string documentLink, RequestOptions options = null);
}