[英][Mongodb]Get document if value list is intersection
我有用戶文檔,其中包含每個用戶播放的樂器列表
User = new mongoose.schema(){
// skiped stuff
instruments: [String]
// more skipped stuff
}
我的路徑函數接受樂器列表,我希望用戶在輸入樂器列表中演奏任何樂器的所有文檔
我一直在嘗試使用
{instruments:{
$elemMatch: {
$in: inputInstrumentList // thought something like this would work :/
}
}
但這只是給我錯誤
先發制人的感謝您的所有幫助
正如chridam所展示的那樣,我對此事考慮得太深了,$ in可以完美地工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.