I have 1 root schema and 4 inherited schemas using a discriminatorKey http://mongoosejs.com/docs/discriminators.html
In this scenario I'm not clear if I can use a wild card text index. The purpose is to index all the string fields of each inherited schema independently. https://docs.mongodb.org/manual/core/index-text/
EDIT
Adding this myRootSchema.index({ "_type": 1, "$**": "text" });
on my mongoose root schema I get this error when I try to query. Should I repeat this on the inherited schemas too?
{
"name": "MongoError",
"message": "error processing query: ns=MYDB.caseNotesTree: TEXT : query=title, language=english, caseSensitive=0, diacriticSensitive=0, tag=NULL\nSort: {}\nProj: {}\n 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?)",
"waitedMS": 0,
"ok": 0,
"errmsg": "error processing query: ns=MYDB.caseNotesTree: TEXT : query=title, language=english, caseSensitive=0, diacriticSensitive=0, tag=NULL\nSort: {}\nProj: {}\n 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?)",
"code": 2
}
the query:
Model
.find(
{ $text : { $search :req.query.q } }
)
.exec(function(err, data) {
if(err)res.json(err)
res.json(data)
});