Using the Cosmos DB SQL API in the Cosmos SDK v3, I'm attempting to query the projects
container, which has an /organization
partition key.
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());
}
The result of this is an error:
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).).
Am I missing something obvious? What does this error mean?