我正在尝试查询具有某种类型产品的Art.这是我的艺术模型:
public string Title { get; set; }
public string Description { get; set; }
public List<Product> Products { get; set; }
public string PaintedLocation { get; set; }
Run Code Online (Sandbox Code Playgroud)
从这里我所做的就是以下LINQ查询:
List<Art> items = DocumentDbHelper.Client.CreateDocumentQuery<Art>(collection.DocumentsLink)
.Where(i => i.type == "art")
.Where(i => i.Products.Any(p => p.Name == productType))
.AsEnumerable()
.ToList();
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
"Method 'Any' is not supported."
Run Code Online (Sandbox Code Playgroud)
我去了代码引用的页面,看看支持什么,但我没有看到它说不支持Any(),所以我可能做错了.任何帮助表示赞赏.
UPDATE
这对我来说真的很奇怪,所以我把它拆开来看看从两个结果中返回的是什么来更好地调试问题:
List<Art> items = DocumentDbHelper.Client.CreateDocumentQuery<Art>(collection.DocumentsLink)
.Where(i => i.Id.Contains("art"))
.AsEnumerable()
.ToList();
items = items.Where(i => i.Products.Any(p => p.Name == productType))
.AsEnumerable()
.ToList();
Run Code Online (Sandbox Code Playgroud)
由于某些原因,这不起作用,因为我将它转换为列表,因此我正在运行查询两次 …
我无法IN为 Azure Cosmos 文档 DB 制定使用子句的搜索查询
询问
{
"query": "SELECT * FROM LOADS l WHERE l.schedulingSystem in (@schedulingSystem)",
"parameters": [
{
"name": "@schedulingSystem",
"value": "A,B"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过在单引号中提供值"value": "'A','B'",但没有成功。我正在使用'x-ms-version', '2018-12-31'标头进行查询
没有错误响应,但得到空白响应(此搜索条件确实存在数据)。
非常感谢任何帮助或指示。