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.

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.