带有查询过滤器的猫鼬中的URL请求查询seach



这是API URL(URL中的数字如1、2、3、4……假设它们为mongoose_id(https://localhost:8000/api/getAllAstrologers?category=1,2,5&技能=6,3,9&languages=&具体化=8&name=manoj&orderby=ASC

我如何用收到的所有这些查询运行我的.fund代码。有时我可能会也可能不会得到所有这些查询。

name: {
type: String,
required: true,
},
languages: [{
astolLang_id: {
type: String,
},
name: {
type: String
}
}],
specilization: [{
astolSpec_id: {
type: String,
},
name: {
type: String
},
specilizationImage:{
type:String
}
}],
category: [{
astolCat_id: {
type: String,
},
name: {
type: String
}
}],
skills: [{
astolSkill_id: {
type: String,
},
name: {
type: String
},
skillImage:{
type:String
}
}],

试试这样的东西:

.find({$or:[{ category: {$in: arrayOfCategories}, skills: {$in: arrayOfSkill}]}

您也可以尝试使用$contains。

最新更新