我的问题是基于 C# 中每个文档的属性及其子文档的属性选择 RavenDB 文档。假设我们有以下文件:
objekts/1:
{
"Code": "1",
"Children": [
{
"Role": "A",
"Place": "Here"
},
{
"Role": "B",
"Place": "There"
}
]
}
objekts/2:
{
"Code": "1",
"Children": [
{
"Role": "A",
"Place": "There"
},
{
"Role": "B",
"Place": "Here"
}
]
}
如何在 C# 中制定查询以选择具有 Code == "1" 和至少一个具有 Role == "A" 和 Place == "There" 的子对象的对象?查询应解析为objekts/2
.
另外,如何制定可以查询的相应 Raven 索引?
数据类
public class Child
{
public string Role { get; set; }
public string Place { get; set; }
}
public class Objekt
{
public string Code { get; set; }
public List<Child> Children { get; set; }
}