Reading the Azure portal I've understood how to make a POST
, PUT
and GET
operation with CosmosDB through the Azure Functions. But deleting, I don't understand how to do this.
Which bindings should I use. Should it occur either through sql query or collection's method, like Remove()?
[**FunctionName**("EmployeeDocumentDB")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", "put", "delete", Route = "EmployeeDocumentDB/partitionkey/{key}/id/{id}")]HttpRequestMessage req,
[DocumentDB(
databaseName: "MyDatabase",
collectionName: "MyCollection",
ConnectionStringSetting = "CosmosDBEmulator")] ICollector<Person> outputDocument,
TraceWriter log)
{
dynamic data = await req.Content.ReadAsAsync<Person>();
return req.CreateResponse(HttpStatusCode.Accepted);
}