const items = await ItemMongo.find({
itemhashname: { $regex: query, $options: 'i' }
}).limit(10);
currently I have this, the problem is that items in my collection looks like this
“substring1 substring2 substring3”
“substring1 substring4 substring5”
“substring1 substring6 substring7”
“substring8 substring2 substring9”
when I input “substring1 substring2” into query, I want the result to be only “substring1 substring2 substring3”, but instead regex seems to cut the string into substrings and search every items that contain those substrings (which mean all of the example above), so more complete the string, the more results I get, which is completely not intended.
is there away to find only those items that contain the exact string input?
expecting is that the more complete the string input, the less results I get, until I get exactly one item with that exact itemhashname. If I use match then unless it’s the exact itemhashname, it won’t return anything