Chapter 3: Regex Operator

Hello.

I was following the class and in the section of the Regex operator I began to have some trouble with Compass. I tried to use a regex operator to do a search but I keep getting an error.

I was able to perform the same operation using the shell without any issues but I wonder if I am having some error on the filter in compass. Any idea what I might be doing wrong?

Thank you.

Hi Diego_77970,

Compass query filter only supports regex when surrounded by quotes instead of slashes like:

 { "awards.text": { "$regex": '^7.*' } }

But you can use slash while using aggregation pipeline like:

Kanika

2 Likes