2016-11-25 23 views
0

我有有每個用戶播放[MongoDB的]獲取文件,如果值列表是路口

User = new mongoose.schema(){ 
    // skiped stuff 
    instruments: [String] 
    // more skipped stuff 
} 

我路徑功能需要在文書清單intruments的列表中的用戶文檔,我希望所有的文檔,其中用戶起到輸入工具列表中的任何儀器

我一直在嘗試使用

{instruments:{ 
    $elemMatch: { 
     $in: inputInstrumentList // thought something like this would work :/ 
    } 
} 

不過,這只是給我的錯誤

任何和所有先發制人感謝幫助

+1

嘗試'User.find({「樂器」:{「$的」: inputInstrumentList}})。exec(回調)' – chridam

回答

0

chridam表現,我認爲得太多問題,並在作品$完全