我在ionic上使用lokijs查找产品。我必须在集合中找到匹配的 products ,其值在 n 嵌套数组或JSON下面给出的文档中或集合。您会看到产品可能包含在儿童的任何地方。但这是文档关系上的最后一个孩子。
我不知道。要在嵌套文档中查找值
[{
"id":1,
"name":"Garbodrain",
"categories":[
{
"id":1,
"name":"Houseold",
"child_categories":[
{
"id":2,
"name":"Small",
"child_categories":[
{
"id":4,
"name":"1000",
"child_categories":[
],
"products":[
]
},
{
"id":5,
"name":"2000",
"child_categories":[
],
"products":[
{
"id":2,
"name":"Garbo Drain 2000",
}
]
}
],
"products":[
]
},
{
"id":3,
"name":"Large",
"child_categories":[
],
"products":[
]
}
],
"products":[
{
"id":1,
"name":"G 1000",
}
]
}
],
"products":[
{
"id":4,
"name":"Un Categorised EcoBin",
}
]}]