我很困惑。单独的查询工作正常,但使用$或,不要。
//combined query does not produce any reuslts
User.find({
$or: [{
$text: {
$search: keyword,
},
}, {
'skills.name': {
$regex: keyword,
$options: "i",
},
}],
active:true,
});
//this query produces results
User.find({
'skills.name': {
$regex: keyword,
$options: "i",
},
active:true,
});
//This query produces results as well
User.find({
$text: {
$search: keyword,
},
active:true,
});
//this does not produce results either
User.find().or([{
$text: {
$search: keyword,
},
}, {
'skills.name': {
$regex: keyword,
$options: "i",
},
}])
没有错误,只有没有结果。
我错过了什么?