Lab - $group and Accumulators using $regexFind

I used regexFind and remove all null but i’m not getting the correct answer for the deviation. Any idea?
regex: /Won [0-9] Oscar/ then removed null using $ne: null

Hi @Woldeab_Seyoum, welcome to the community :wave:.
As mentioned in the lab the awards field could contain terms like:

Won 13 Oscars
Won 1 Oscar

Therefore, you need to update your regex accordingly to accommodate plural as well as singular Oscar terms. Take a look at this Optional Character in Regex guide to learn more.

Also, you don’t have to exclude the null because the regex will filter them out anyways.

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

1 Like

Hi
I used this for the match:

"awards": {$regex: "won [0-9]* oscar", $options: "i"}

and then remember the difference between $stdDevPop and $stdDevSamp

hope it helps