dbo.collection("intent").find({ input: { $all : [ { $regex: new RegExp("^" + message.toLowerCase(), "i") } ] } }).toArray(function(err, result) {
});
显示了错误
MongoError:$ all中没有$表达式,
答案 0 :(得分:0)
如果没有样本数据集,或者您正在尝试做什么的任何迹象,我就无法理解为什么您希望在一组中执行$all
匹配正则表达式。
如果您希望项目与多个正则表达式匹配,请相应地编写正确的正则表达式并使用$regex
。
类似的东西:
{ <field>: { $regex: /(?=.*word1)(?=.*word2)(?=.*word3)/, $options: '<options>' } }
将返回<field>
匹配所有三个单词的所有对象。
您可能还希望了解可能对您有帮助的$and
或$or
运营商。