0
此问题涉及使用C#在Mongo DB中获取嵌套文档的不同值。我的文档的集合,每个文档具有结构:使用C#从MongoDB中的集合获取不同的嵌套文档值
{
key1: value1,
key2: value2,
key3: {
nestedKey1: nestedValue1,
nestedKey1: nestedValue1
}
}
我需要查询基于key1的的值不同nestedKey1值的列表。我可以做到这一点通过使用命令(使用Robomongo壳):
db.runCommand({distinct:'collection_name', key:'key3.nestedKey1', query: {key1: 'some_value'}})
但我怎么在C#(tutorial here)
[C#的MongoDB DISTINCT查询语法](的可能的复制https://stackoverflow.com/questions/35725113/c -sharp-mongodb-distinct-query-syntax) – Veeram
@Veeram在这种情况下,我如何指定密钥key3.nestedKey1?并且不要忘记必须是key1的过滤器:'some_value' –