mongoosesearch产生神秘的错误

我正在使用Mongoose-Text-Search插件( https://github.com/aheckmann/mongoose-text-search )来search我的mongodb数据库,但是我收到了一个令我困惑的错误消息,我从未见过之前。

error: name=MongoError, ok=0, errmsg=error processing query: ns=testdb.data limit=100 skip=0 Tree: TEXT : query=test, language=, tag=NULL Sort: { $s: { $meta: "textScore" } } Proj: { $s: { $meta: "textScore" } } planner returned error: failed to use text index to satisfy $text query (if text index is compound, are equality predicates given for all prefix fields?) 

有人可以解释这是什么意思? 我想我正确地使用文本search插件,但是我不能为了我的生活找出这里有什么问题。

谢谢!

  1. 看起来您在Mongodb中创build了COMPOUND全文search索引。 正因为如此,您必须与其他字段一起请求来自全文search索引的数据。 查看详情: http : //docs.mongodb.org/manual/tutorial/limit-number-of-items-scanned-for-text-search/

有一些限制,比如你不能使用$ gt / $ gte / $ lt / $ lte / $ in / $ type来组成$和/ $或者etc作为谓词字段。 详情请点击: https : //jira.mongodb.org/browse/SERVER-13801

  1. 升级到Mongo 2.6.4,并通过Mongoose-Text-Search插件。 该插件仅适用于Mongo 2.4.x,对于现代Mongo版本而言是绝对多余的。 只需使用find()方法进行全文search。