Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegExp queries not working as documented #1403

Closed
gaarf opened this issue Mar 27, 2013 · 1 comment
Closed

RegExp queries not working as documented #1403

gaarf opened this issue Mar 27, 2013 · 1 comment

Comments

@gaarf
Copy link

gaarf commented Mar 27, 2013

According to comments from @aheckmann around the internets (eg https://groups.google.com/d/msg/mongoose-orm/d9crUPzMEvk/G23HFlyalokJ), the following query with a literal regular expression should work using Mongoose:

Model.find({ foo: /bar/i });

But it does not, ie it returns an empty set. The correct way seems to be:

Model.find({ foo: {$regex:'bar', $options:'i'} })


More details: https://gist.github.com/gaarf/5256378/raw/d0214f395706961cff058098663731904cfe88d5/gistfile1.txt

@aheckmann
Copy link
Collaborator

Cannot reproduce. https://gist.github.com/aheckmann/5257502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants