DocumentDB API 输出绑定 DELETE
DocumentDB API output binding DELETE
带有 HTTP 触发器和 2 个 DocumentDB 绑定的 Azure 函数应用程序 - 输入和输出。
在 this page 上有很好的示例说明如何添加新文档、获取现有文档并更新它。但是 - 没有关于如何删除一个的示例!
是否可以使用输出绑定删除现有文档?如果没有,最好的替代方法是什么 - 在函数中使用 Azure SDK?
谢谢
是的,要删除文档,您必须编写一个 Azure 函数...如果您使用的是 changefeed,这里是 pcode。
#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);
}
带有 HTTP 触发器和 2 个 DocumentDB 绑定的 Azure 函数应用程序 - 输入和输出。
在 this page 上有很好的示例说明如何添加新文档、获取现有文档并更新它。但是 - 没有关于如何删除一个的示例!
是否可以使用输出绑定删除现有文档?如果没有,最好的替代方法是什么 - 在函数中使用 Azure SDK?
谢谢
是的,要删除文档,您必须编写一个 Azure 函数...如果您使用的是 changefeed,这里是 pcode。
#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);
}