我正在尝试将我的 DocumentDB nuget 包从 1.13 升级到 1.18
我在升级具有 DocumentClient 绑定的天蓝色函数时遇到问题。
在 DocumentDB 1.13 中,绑定部分不采用 :{Id} 作为绑定参数,而是完美地创建了 DocumentClient 对象。而 DocumentDB 1.18 需要 {Id} 作为绑定参数 [我不想要,因为我想遍历集合中的整个文档]
我在 1.18 之前的 host.json 绑定是
{
"frameworks": {
"net46": {
"dependencies": {
"Dynamitey": "1.0.2",
"Microsoft.Azure.DocumentDB": "1.13.0",
"Microsoft.Azure.WebJobs.Extensions.DocumentDB": "1.0.0"
}
}
}
我的 local.settings.json 只有
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "
DefaultEndpointsProtocol=xxxxx/xxxxx==;EndpointSuffix=core.windows.net",
"AzureWebJobsDashboard": "",
"AzureWebJobsDocumentDBConnectionString":
"AccountEndpoint=xxxxx/;AccountKey=xxxx==;",
}
}
我的天蓝色功能看起来像
[FunctionName("DeleteAVFeedAuditData")]
public static async Task Run([TimerTrigger("0 0/1 * * * *")]TimerInfo myTimer, [DocumentDB]DocumentClient client,
TraceWriter log)
{
var c = client;
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
var value=ConfigurationManager.AppSettings["AVAuditFlushAfterDays"];
var collectionUri = UriFactory.CreateDocumentCollectionUri("AVFeedAudit", "AuditRecords");
//var documents = client.CreateDocumentQuery(collectionUri,"Select * from c where c.EndedAt");
//foreach (Document d in documents)
//{
// await client.DeleteDocumentAsync(d.SelfLink);
//}
}
}
现在,当使用更新的 documentDB 1.18 包运行 azure 函数时,它说绑定 {Id} ,这将只给出具有指定 id 的单个文档。而我的要求与以前版本的 DocumentDB 1.13 相同。
请告诉我如何使用新的更新包获取与我的 DocumentClient 绑定的整个文档。