I'm using this $nin
query for $regex
search but it does not work:
first_name: { $nin: [ "/^rahul/i", "/^Bhosale/i" ] }
With this query execution, I was unable to find a result without "rahul" or "bhosale" but when I hit this query like below
first_name: { $nin: [ /^rahul/i, /^Bhosale/i ] }
it works fine.
when I pass an array to find()
I think it takes the backslash with double quotes that why it was unable to find a result.
How can I solve this problem?