|
It appears that using $or to query both _id and a text index do not work together.
See this example:
db.createCollection('c', {clusteredIndex: {key: {_id: 1}, unique: true}})
|
db.c.createIndex({b: "text"})
|
db.c.insert({b: "foo"}
|
db.c.find({$or: [{$text: {$search: "foo"}}, {_id: 1}]})
|
This fails with the following error:
error processing query: ns=test.cTree: $or
|
_id $eq 1
|
TEXT : query=foo, language=english, caseSensitive=0, diacriticSensitive=0, tag=NULL
|
Sort: {}
|
Proj: {}
|
planner returned error :: caused by :: Failed to produce a solution for TEXT under OR - other non-TEXT clauses under OR have to be indexed as well.
|
|