我正在尝试从Cosmos DB中删除我的物品。但是我收到一个错误,即具有指定ID的实体不存在。我想念什么?
static DocumentClient docClient = null;
string id;
public PostService()
{
}
static readonly string databaseName = "xxxx";
static readonly string collectionName = "xxx";
public async Task DeletePost(Post selectedPost)
{
if (!Initialize())
return;
var docUri = UriFactory.CreateDocumentUri(databaseName, collectionName, selectedPost.Id);
await docClient.DeleteDocumentAsync(docUri, new RequestOptions() { PartitionKey = new Microsoft.Azure.Documents.PartitionKey(id)});
}