Lab - $group and Accumulators, mistake in detailed answer?


I’ve noticed in the detailed answer of this laboratory that part of the filter is ‘Oscars?/’.
Shouldn’t it be '‘Oscar?/’ ?

In any case the result if the same. I only made a stupid mistake using a worng function.

Also I’ve tried to use $divide and $trunc for the decimal values calculations, without success. How can you truncate easily this results?

The ? signifies that the preceding expression is optional, so it will match “Oscar” or “Oscars”, but wouldn’t match “Oscarz”.

Ok, than you, I just realize that I don’t know how the syntax and special symbols of regular expressions work in MongoDB…

I used the following document as a reference to get the correct regular expression for this problem.

Thank you very much for sharing!

Thanks, very useful.