0

How will I apply regex on mongo db's raw_query? I tried

{'foo.bar': {$regex:'.*test.*'}}

but django shell complained for an invalid syntax.

I also tried

{'foo.bar': '.*test.*'}

assuming that the regex will take effect. But the result is empty

Thanks in advance!

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
jaysonpryde
  • 2,733
  • 11
  • 44
  • 61

1 Answers1

0

It's (also) { "foo.bar": /.*test.*/ } on the shell - have you tried that? See http://docs.mongodb.org/manual/reference/operator/query/regex/

xeraa
  • 10,456
  • 3
  • 33
  • 66