> db.foo.ensureIndex({a:"text"})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.insert({a:"hello world"})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.find({$text:{$search:"hello"}}) // works before creating {_fts:1} index
|
{ "_id" : ObjectId("53151b403d6c9988adb3eed8"), "a" : "hello world" }
|
> db.foo.ensureIndex({_fts:1})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.find({$text:{$search:"hello"}}) // fails after creating {_fts:1} index
|
error: {
|
"$err" : "Unable to execute query: error processing query: ns=test.foo limit=0 skip=0\nTree: TEXT : query=hello, language = , tag=First: 0 1 notFirst: full path: _fts\nSort: {}\nProj: {}\n planner returned error: need exactly one text index for $text query",
|
"code" : 17007
|
}
|
>
|