Reading the Azure portal I\'ve understood how to make a POST, PUT and GET operation with CosmosDB through the Azure Functions. But del
You could do this by binding directly to the DocumentClient itself, and delete the Document programatically.
[FunctionName("DeleteDocument")]
public static async Task Run(
[TimerTrigger("00:01", RunOnStartup = true)] TimerInfo timer,
[DocumentDB] DocumentClient client,
TraceWriter log)
{
var collectionUri = UriFactory.CreateDocumentCollectionUri("ItemDb", "ItemCollection");
var documents = client.CreateDocumentQuery(collectionUri);
foreach (Document d in documents)
{
await client.DeleteDocumentAsync(d.SelfLink);
}
}
See CosmosDBSamples