我正在尝试在我的 .NET C# 应用程序中使用 BulkDelete 函数(用于 Cosmos DB 图形数据库),该函数接受字符串查询并删除所有结果。文档:https ://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.graph.graphbulkexecutor.bulkdeletasync?view=azure-dotnet
由于我不知道要在图中删除的顶点和边的 Id 和分区键,因此我无法使用此 BulkDelete API:https ://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting -started#bulk-delete-api
使用 CosmosDB.BulkExecutor.Graph.GraphBulkExecutor.BulkDeleteAsync (将查询作为字符串接收)会引发此异常:
System.NotImplementedException:方法或操作未实现。在 Microsoft.Azure.CosmosDB.BulkExecutor.Graph.GraphBulkExecutor.BulkDeleteAsync(字符串查询,Nullable`1 deleteBatchSize,CancellationToken cancelToken)在...
相关代码片段:
// Prepare for bulk delete
var bulkExecutor = new GraphBulkExecutor(client, dataCollection);
await bulkExecutor.InitializeAsync();
var cancellationToken = new CancellationTokenSource().Token;
string query = "g.V().hasLabel('user')";
BulkDeleteResponse bulkDeleteResponse = null;
try
{
bulkDeleteResponse = await bulkExecutor.BulkDeleteAsync(query, 1000, cancellationToken);
PrintSummaryofBulkDelete(bulkDeleteResponse);
}
catch (DocumentClientException de)
{
LogUtility.Error("Document client exception: {0}", de);
}
catch (Exception e)
{
LogUtility.Error("Exception: {0}", e);
}
是真的没有实现还是我在使用它时犯了错误?