-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.6.0-rc0
-
Component/s: Text Search
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When a $text query fails because of a missing predicate on the text index prefix, the error message should be "missing equality predicate on text index prefix field", not "need exactly one text index".
> db.foo.ensureIndex({a:1,b:"text"})
WriteResult({ "nInserted" : 1 })
> db.foo.insert({a:1,b:"hello"})
WriteResult({ "nInserted" : 1 })
> db.foo.find({a:1,$text:{$search:"hello"}})
{ "_id" : ObjectId("53151373b685b3ee5e58e538"), "a" : 1, "b" : "hello" }
> db.foo.find({$text:{$search:"hello"}})
error: {
"$err" : "Unable to execute query: error processing query: ns=test.foo limit=0 skip=0\nTree: TEXT : query=hello, language = , tag=First: notFirst: full path: _fts\nSort: {}\nProj: {}\n planner returned error: need exactly one text index for $text query",
"code" : 17007
}
>