标签: mongodb
我想使用$text使用文本搜索mongodb来按标题搜索产品:
$text
代码:
var scemmaa = new mongoose.Schema(product); scemmaa.index({ title: 'text' }); Product.find({$text: { $search: query}});
但它始终记录这些错误:[Error: Can't use $text with String.]
[Error: Can't use $text with String.]