我想查詢我的MongoDB集合(名稱:包裝)和檢索領域有「網址」與「.com」之間查詢嵌套文檔MongoDB中
結束我不知道如何查詢嵌套的所有文件文件,也使用正則表達式進行查詢。
我實際上是在Perl中編寫它。然而,在mongo shell上運行的查詢也可以。
在此先感謝!
樣本數據:
{ "_id" : ObjectId("4e7a34932cd4b16704000000"), "lastArray" : { "desc" : "google", "url" : "google.com", "data" : [
{
"name" : "1",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
},
{
"name" : "2",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
}
{ "_id" : ObjectId("4e7a34932cd4b16704000001"), "lastArray" : { "desc" : "yahoo", "url" : "yahoo.com", "data" : [
{
"name" : "1",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
},
{
"name" : "2",
"xpath" : [ ],
"nodes" : [ ],
"type" : "Any Text"
}
除了我自己,另請參閱Mongodb開發者手冊:http://www.mongodb.org/display/DOCS/Dot+Notation+%28Reaching+into+對象29% – Dag