1
Reference.find(
            {$and: [
                {'url': url},
                {"text" : {$regex : text, '$options' : 'i'}}
            ]})

Whenever I test out text with 'Hello World', I get back documents that have that text exactly. However, if I were to do 'Hello Worl', I get nothing back, even with the same url. I've tried numerous implementations of ReGex, and so far none have worked. I'm using Mongo 3.2.11 if that matters.

db2791
  • 1,040
  • 6
  • 17
  • 30

1 Answers1

1

Try with the following string '.*content.*' or regex format /.*content.*/, which are the widely supported regex formats.

Also, see Checking if a field contains a string

Community
  • 1
  • 1
zurfyx
  • 31,043
  • 20
  • 111
  • 145