I have mongodb with a $text-Index
and elements like this:
{
foo: "my super cool item"
}
{
foo: "your not so cool item"
}
If i do search with
mycoll.find({ $text: { $search: "super"} })
i get the first item (correct).
But i also want to search with "uper" to get the fist item - but if i try:
mycoll.find({ $text: { $search: "uper"} })
I dont get any results.
My Question: If there is a way to use $text so its finds results with a part of the searching string? (e.g. like '%uper%'
in mysql
)
Attention: I dont ask for a regex only search - i ask for a regex-search within a $text-search!
It's not posible to do it with $text
operator.
Text indexes are created with the terms included in the string value or in a strings array and the search is based in those idexes.
You can only group terms on a pharse but not take part of them.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments