Chapter 3: Core Aggregation - Combining Information Lab - $group and Accumulator

Hello!

For the above problem, I built my query strings with the Atlas Finder which is linked to the mflix database. I got all the values but I know it’s a different database from the one used in this course. When I tried inputting the query strings with db.movies.aggregate( … ), I got a blank response, not even an error message. Any advice?

Hi @SOO_QUEK, welcome to the community.
Can you please post a screenshot, code sample, and steps to reproduce the issue you are facing?

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

Thanks and Regards.
Sourabh Bagrecha

Hi @SOO_QUEK.
Did you try running the: use <--- database name ---> command before running the aggregation command?
If not, I would recommend running the following command:

use sample_mflix

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

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

I think your $match is wrong.

Any reason why you are using awards.text rather than awards as mentionned in the lab as

HINT - All movies in the collection that won an Oscar begin with a string resembling one of the following in their awards field

I am using the aggregations db which has movies as a collection.

I was using the sample_mflix database which has awards.text as a field. It did produce a credible result on my Atlas Finder, nevertheless. Even removing the .text, I still produce a blank response instead of some error message.

Hi @SOO_QUEK, that’s really strange.
What do you mean when you say “Atlas FInder”?
Can you post a screenshot for the same along with the working code?

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

That is wrong. The database that you should use for M121 is aggregations. The collections is movies. You should be using the shared cluster as indicated in the first few lessons.

The field is named awards, as indicated in the lab notes.

1 Like

You don’t need RegExp! You could do something like : match: { awards: /Won \d{1,2} Oscars?/ }

You do.

The following is a short-cut to regex but it is still a regular expression:

See https://docs.mongodb.com/manual/reference/operator/query/regex/

1 Like