'It is possible to combine $regex and $search operator?
I want to perform a find using a field that is a string array
"tags": ["tag","lóngword", "word", "test"]
I want this document match as result if i search for lóngword, longword or lon
For the accents marks I have read that I can create an index and use the $text operator. This just works with lóngword and longword, but it is not working with lón
I am making this query:
db.getCollection('course').find({$text: {$search: "longword", $diacriticSensitive: false}})
I thought in doing something like this:
db.getCollection('course').find({$text: {$search: {$regex: "lón"}, $diacriticSensitive: false}})
But I get this error:
Error: error: {
"ok" : 0,
"errmsg" : "\"$search\" had the wrong type. Expected string, found object",
"code" : 14,
"codeName" : "TypeMismatch"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
