Regular expressions in $match stage

I found the right answer to the CH2 Lab1 and I have try to replicate it in the Atlas tool, but it doesn’t work.
This is the correct aggregate:
$match: /<regular expression>/
I copied and pasted the regular expression in the Atlas, but it doesn’t work.
Another question is: I solved the Lab in an another way: splitting the awards string into an array of words and then finding the word “Won” in the resulting array, but I get more documents than expected. Why?

Searching just by the word “Won” does not guarantee that you are going to get only the movies that won Oscars as the award. There are many other awards as well.
Constructing a more specific regular expression for the $match stage can solve your problem.
Try to include the word “Oscar” in your regular expression.

1 Like