I try to create search feature using $text and $search in mongoose but it stuck when the query meet mongodb english stop words. I try to change my default_language to none to ignore the stop words list but then I realized that I cannot change the default_language.
I was wondering the way my mongoose always create index with default_language: english, even I directly use default_language: 'none'.
Here is my code:
kataSchema.index({ kata: "text" }, { default_language: 'none' });
and then when I open mongo shell and type db.katas.getIndexes(), it's always showing me this:
[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_"
},
{
"v" : 2,
"key" : {
"_fts" : "text",
"_ftsx" : 1
},
"name" : "kata_text",
"background" : true,
"weights" : {
"kata" : 1
},
"default_language" : "english",
"language_override" : "language",
"textIndexVersion" : 3
}
]
I also try to delete the index in mongo shell and run my code again but it still use english as its default_language.
Do I miss at something or else? I was already searching for it everywhere but still cannot find the issue. Thanks for advice.
mongoose version: "^5.10.0"