gpt4 book ai didi

Azure Cosmos DB SDK v3 查询多个文档失败 : Gateway Failed to Retrieve Query Plan

转载 作者:行者123 更新时间:2023-12-03 23:50:49 34 4
gpt4 key购买 nike

使用 Cosmos SDK v3 中的 Cosmos DB SQL API,我尝试查询 projects 容器,该容器具有 /organization 分区键。


var cosmosDb = await Storage.GetCosmosDb();
var queryDefinition = new QueryDefinition($"SELECT * FROM projects project WHERE project.organization = '{CurrentUser.Organization}'");
var queryRequestOptions = new QueryRequestOptions
{
PartitionKey = new PartitionKey("organization"),
};
var projectsQuery = cosmosDb.Containers[typeof(Project)]
.GetItemQueryIterator<Project>(queryDefinition, null, queryRequestOptions);
var projects = new List<Project>();
while (projectsQuery.HasMoreResults)
{
projects.AddRange(await projectsQuery.ReadNextAsync());
}

结果是一个错误:

Response status code does not indicate success: 400 Substatus: 0 Reason: (Response status code does not indicate success: 400 Substatus: 0 Reason: (Gateway Failed to Retrieve Query Plan: Unknown QueryFeatures: NonValueAggregateActivityId: ceb5a509-36a0-4e20-87cd-32b6425dc757, Microsoft.Azure.Documents.Common/2.4.0.0, Windows/10.0.18362 cosmos-netstandard-sdk/3.2.1).).

我是否遗漏了一些明显的东西?这个错误是什么意思?

最佳答案

将 CosmosDB 模拟器更新到最新版本应该可以解决该问题。

我在 2.4.5 上遇到了这个问题,在 2.5.7 上就不再有这个问题了。

关于Azure Cosmos DB SDK v3 查询多个文档失败 : Gateway Failed to Retrieve Query Plan,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58123896/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com