从 DocumentDB 中删除文档不会 return 删除的文档
Deleting a document from DocumentDB doesn't return the deleted document
我在我的 MVC 项目中使用 this DocumentDB 库。当我在 DocumentClient
中调用 DeleteDocumentAsync
方法时,它 returns Null
。但是,如果您查看方法签名,它会清楚地表明它 return 是一个文档:public Task<ResourceResponse<Document>> DeleteDocumentAsync(Uri documentUri, RequestOptions options = null);
另外在评论中说,如果有帮助的话:
// Returns:
// The task object representing the service response for the asynchronous operation.
知道为什么它 return 什么都没有吗?我希望它 return 已删除的文档。
命令 DeleteDocumentAsync
不会 return 删除的记录本身,而是 return 一个指定删除了多少记录的文档。例如,如果你 运行 这个:
var result = await collection.DeleteDocumentAsync(filter);
您可以使用result.DeletedCount
查询删除的记录数。
查看驱动程序的源代码它实际上 return 是一个 DeleteResult
文档,查看 GitHub 上的源代码。
我在我的 MVC 项目中使用 this DocumentDB 库。当我在 DocumentClient
中调用 DeleteDocumentAsync
方法时,它 returns Null
。但是,如果您查看方法签名,它会清楚地表明它 return 是一个文档:public Task<ResourceResponse<Document>> DeleteDocumentAsync(Uri documentUri, RequestOptions options = null);
另外在评论中说,如果有帮助的话:
// Returns:
// The task object representing the service response for the asynchronous operation.
知道为什么它 return 什么都没有吗?我希望它 return 已删除的文档。
命令 DeleteDocumentAsync
不会 return 删除的记录本身,而是 return 一个指定删除了多少记录的文档。例如,如果你 运行 这个:
var result = await collection.DeleteDocumentAsync(filter);
您可以使用result.DeletedCount
查询删除的记录数。
查看驱动程序的源代码它实际上 return 是一个 DeleteResult
文档,查看 GitHub 上的源代码。