比方说,我的一些文件具有以下结构:Cloudant /芒果选择了深嵌套JSONs
{
"something":{
"a":"b"
},
"some_other_thing":{
"c":"d"
},
"what_i_want":{
"is_down_here":[
{
"some":{
"not_needed":"object"
},
"another":{
"also_not_needed":"object"
},
"i_look_for":"this_tag",
"tag_properties":{
"this":"that"
}
},
{
"but_not":{
"down":"here"
}
}
]
}
}
是否有芒果JSON选择器可以在具有值"this_tag"
"i_look_for"
成功地选择?它在一个数组内(我知道它在数组中的位置)。我也对筛选结果感兴趣,所以我只得到结果中的"tag_properties"
。
我已经尝试了很多东西,包括$ elemMatch,但所有东西大多返回“无效json”。
即使是芒果的用例还是应该坚持观点?
这将返回0文档:据我所知,是因为'i_look_for'不是what_i_want'的'直接财产,但阵列的成员'is_down_here' – zlr
你尝试过'what_i_want.0.i_look_for'吗? – Flimzy
非常酷,它的作品。我确实尝试了这个数组索引表示法,但失败了,所以谢谢!接下来的问题是我怎样才能避免位置论证,但有一个新的答案,所以我应该全部设置 – zlr