Lab - Bringing it all together

Calculate an average rating for each movie in our collection where English is an available language.
I do not see a field for language. Which collection and field are they referring to in this Question

May be the course has changed since I took it because the Lab - Bringing it all together is not the same question.

But in any case, M121 uses the aggregations database. Then the collection must be movies. Since MongoDB is schema-less, so some documents might not have the field languages.

They refer to movies but that’s correct, you can find out using something like this:

db.movies.countDocuments({})
44488
db.movies.countDocuments({languages:{$exists:true}})
43444

Although I was guessing “languages” is not nested. Another option is to sample 10 docs and see the structure.

Also, Compass or Atlas are useful to have an overall idea of the fields and types.


@steevej-1495 pd probably pretty much the same, most lessons are working with MongoDB <= 3.6, there are a few new videos on $merge in case you are interested. Those are newer since $merge is 4.2+

1 Like

Hi @jean_boulet,

Make sure that you connected to the Atlas Cluster using the correct connection string:

mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/aggregations?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl -u m121 -p aggregations --norc

If you still have any questions, please feel free to reach out.

Kind Regards,
Sonali