I have a question about querying in MongoDB. I currently have a query that looks like this:
db.mycollection.find({
$text: {
$search: "my -city"
}
})
When running this query, it negates the term city
, but I actually want to search for the exact phrase my -city
. Is there a way to achieve this without negation?
The text I am trying to search for may include variations such as my-city
or my - city
or my -city
. How can I instruct MongoDB to perform an exact string match instead of using negation as the default behavior?