Hi Julius
I believe this is caused by two separate things:
$or is a special operator that behaves slightly differently compared to e.g. $andThe page Text Indexes, especially the restrictions section describes how text indexes behaves in a different manner compared to typical compound index.
Also, the $or page contains an explanation about the behaviour of $or. Specifically:
When evaluating the clauses in the $or expression, MongoDB either performs a collection scan or, if all the clauses are supported by indexes, MongoDB performs index scans.
That is, a query such as
db.test.find({$or: [{a:1}, {b:1}]})
can be thought of like two queries of db.test.find({a:1}) and db.test.find({b:1}), where the results of both queries are combined. This is why a $or query can use two (or more) different indexes. In contrast, typical find() queries will only use one index.
In terms of your query, since you’re combining those two special characteristics in a single query, MongoDB cannot use the compound text index like a normal compound index. However, if you remove one of the $or term, the query can use the compound text index, since the query basically becomes {$text: {$search: ...}, field: ...} (i.e. the $or has no effect anymore).
Best regards
Kevin