0
我正在流星建立一個應用程序,我想從一個Mongo集合中檢索testKey = 1的圖像數組。結果是我將有一個Javascript變量,它包含一個如下所示的數組:如何從文檔中檢索與特定ID匹配的數組?
["filepath-here", "filepath2-here",...}
例蒙戈集合:
{
"testKey": 1,
"images": [
"filepath-here",
"filepath2-here",
]
}
我已經試過這樣:
var testImgCount = Tests.find({ testKey : randomTest }, { fields: { 'images': 1, '_id':0 }}).fetch();
當我CONSOLE.LOG返回[對象],當我打開了它表明
[0: object, length: 1, _proto_: Array[0]
0: object
在這種情況下認爲,我試圖讓訪問陣列。我怎麼去解決這個問題只返回這個值?