更新时间:2021-07-02 22:31:54
我合并了:
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "delete")] HttpRequest req,
[CosmosDB(databaseName: "storage", collectionName: "pizza", Id = "{Query.id}", PartitionKey = "{Query.storeId}", ConnectionStringSetting = "..."] Document document,
[CosmosDB(databaseName: "storage", collectionName: "pizza", ConnectionStringSetting = ...)] DocumentClient client)
{
string storeId = req.Query["storeId"];
if(document == null || string.IsNullOrEmpty(storeId))
return new BadRequestResult();
await client.DeleteDocumentAsync(document.SelfLink, new RequestOptions() { PartitionKey = new PartitionKey(storeId) });
return new OkResult();
}