Open shrop opened 9 years ago
Were you able to workaround to this?
I don't think you can use a Javascript regex in a Mongo query that way; you should try the string literal version: https://docs.mongodb.com/manual/reference/operator/query/regex/ . Otherwise, use $regex
.
@mizzao Yes. I did the same. Will share the code in some time to help others who face this issue.
Thanks for responding and making this great package!
I have seen a few examples like below:
I am actually trying the code above. If I put a string in place of
regex
, it is passed and works correctly, but when I use theregex
variable, the output sent to query looks like this'profile.firstName': {} } { limit: 10, sort: { _id: 1 } }
. Notice theregex
portion is missing.Anyway, I am not sure why this doesn't work yet. Any thoughts?