比方說,我的一些文件具有以下結構: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