0
我有一些麻煩,試圖查詢在蒙戈的字段。我的文檔看起來像這樣:查詢MongoDB的嵌入式陣列
{
"short_url": "DTsB9k",
"long_url": "http://www.example.com",
"date_created": {
"$date": "2013-01-01T14:10:29.899Z"
},
"ips": {
"24.184.209.227": {
"ip_address": "12.34.56.78",
"clicks": [
{
"click_date": {
"$date": "2013-01-01T14:10:41.784Z"
},
"click_referrer": null
},
{
"click_date": {
"$date": "2013-01-01T14:31:32.440Z"
},
"click_referrer": null
}
]
}
},
"users": {
"4": {
"user_id": "4",
"date_added": {
"$date": "2013-01-01T14:10:29.899Z"
},
"creator": true
}
},
"total_clicks": 2,
"_id": {
"$oid": "50e2ee55569df0b469000000"
}
}
我想查詢user_id,最終會有多個。但我試過
{ "users" : "4" }
{ "users.user_id" : "4" }
{ "users.*.user_id" : "4" }
這些都沒有工作。我在這做錯了什麼?