我很难找到嵌套在第n级的子文档的所有者。
这是建议的文档结构。
{
"_id": "foo_l0",
"subdocs" : [
{
"_id" : "foo_0_l1"
},
{
"_id" : "foo_1_l1",
"subdocs": [
{
"_id": "foo_0_l2",
"subdocs": [
{
"_id": "foo_0_ln",
"subdocs" : []
}
]
},
{
"_id": "foo_1_l2",
"subdocs": [
{
"_id": "foo_0_ln",
"subdocs": []
}
]
}
]
}
]
}
我希望能够使用嵌套在第n级的foo_0_ln找到foo_l0。 (n未知)
换句话说,不管子文档嵌套在所有者文档中有多深,都可以使用其中一个子文档的id查询MongoDB吗?