Reputation: 46
I want to search in mongodb a regex expression using text index (I believe for regex search this one is most beneficial).
There is only one field on which to carry out the query. I have created the index like
{ "final : "text"}
using mongodb compass.
and then when i use this command in integrated mongosh terminal,
db.hello1.find({"final" : { $regex: 'Cleanser', $options: 'i' }}).hint({final : "text"}).explain()
It gives me the following error:
planner returned error :: caused by :: hint provided does not correspond to an existing index
While clearly the compound index exits, of type text _fts(text) _ftsx.
Can someone guide me around this ?
Upvotes: 0
Views: 1147