[错误:不能在字符串中使用$ text。]

时间:2017-05-15 14:28:51

标签: mongodb

我想使用$text使用文本搜索mongodb来按标题搜索产品:

代码:

var scemmaa = new mongoose.Schema(product);
scemmaa.index({ title: 'text' }); 
Product.find({$text: { $search: query}});

但它始终记录这些错误:[Error: Can't use $text with String.]

0 个答案:

没有答案