Chapter 3 Lab - $group and Accumulators - wrong answers?

Hi, I am using match stage with regular expression to filter for movies that have won some oscars, but whatever I do, I am not able to get even max value in group stage that would match any of the answers provided. Is it possible that the answers provided do not match the latest data provided in the course? The assignment mentions field “awards”, however we must match against “awards.text” field. I am using test-jqe4b.mongodb.net:27017/vdeo.movieDetails collection - hope that is the right one? The lab doesn’t mention where to connect for the task.
Thanks!

uhm, just working on the same lab, and having the same problem (i use ‘awards’ in the $match stage though).
Just wondering, are your results somewhat similar to these?

{ “_id” : null, “highest_rating” : 9.4, “lowest_rating” : 1.6, “average_rating” : 6.7136079052576, “deviation” : 0.9304618685994673 }

Comparing our results could allow us to figure out what’s wrong with our criteria.
You match all the items with awards either they have nomination or not dont’you? And the actual ‘awards’ field does not match perfectly the one presented as example in the lab, is it correct?

Well, I am actually getting those:

_id:null
highest_rating:9
lowest_rating:5.5
average_rating:7.740963855421687
deviation:0.6174369019956045

I am matching for awards.text, because the document structure is

{ ... "awards":{"wins":4,"nominations":5,"text":"4 wins & 5 nominations."} ... }

Ah, so we’re querying different dbs ^^
Here is an example of what the records looks like:
Query
db.movies.find({"awards": {$exists: true}}, {"awards":1})

Result(random copy-pasted):

{ "_id" : ObjectId("573a1391f29313caabcd8792"), "awards" : "1 nomination." }
{ "_id" : ObjectId("573a1391f29313caabcd8acf"), "awards" : "1 win." }
{ "_id" : ObjectId("573a1391f29313caabcd8b94"), "awards" : "Won 1 Oscar. Another 1 win & 1 nomination." }
{ "_id" : ObjectId("573a1391f29313caabcd8521"), "awards" : "1 win." }
{ "_id" : ObjectId("573a1391f29313caabcd8945"), "awards" : "Won 3 Oscars. Another 2 wins & 1 nomination." }
{ "_id" : ObjectId("573a1391f29313caabcd8978"), "awards" : "2 nominations." }
{ "_id" : ObjectId("573a1391f29313caabcd8ba2"), "awards" : "2 nominations." }
{ "_id" : ObjectId("573a1391f29313caabcd8a75"), "awards" : "1 win." }
{ "_id" : ObjectId("573a1391f29313caabcd8d96"), "awards" : "1 win." }

Funny thing is that i was filtering using ‘1 win.’ as ‘winning result’ so to say, didn’t noticed that there were actually also the ones indicated by the lab ^^
That will solve my problem i guess :stuck_out_tongue:
About yours, this is the connection string i use ( came from earlier lessons) :
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

Good luck! :+1:

EDIT:
Actually it doesn’t solve anything for me xD Keep trying anyway :stuck_out_tongue:
Nvm, manage to do it ^^ Just to give you a warning, that darn field is much complex than it appears ^^

Few samples:

{ "awards" : "Won 1 Golden Globe. Another 1 win & 8 nominations."}
{ "awards" : "Won 1 Oscar. Another 12 wins & 8 nominations."}
{ "awards" : "Won 1 Oscar. Another 9 wins & 5 nominations."}
{ "awards" : "Won 2 BAFTA Film Awards. Another 3 wins & 4 nominations."}
{ "awards" : "Won 1 BAFTA Film Award. Another 6 wins & 2 nominations." }
{ "awards" : "Won 1 Primetime Emmy. Another 2 wins & 4 nominations." }
{ "awards" : "Won 2 Oscars. Another 10 wins & 26 nominations." }
{ "awards" : "Won 1 Oscar. Another 4 wins & 14 nominations." }
{ "awards" : "Won 1 Primetime Emmy. Another 11 wins & 6 nominations."}

Cool! Thanks for pointing me to the right db. I haven’t realized there is a db “aggregations” and collection “movies” in db “video” which is commonly used in the lecture does not contain imdb rating data.

@Petr_06961

All the work in this course is in the Atlas cluster, which is accessed as described in the Week 0: Introduction lecture “Atlas Requirement” and which has both the connection string and a list of the collections that you should be seeing. If you use that, it will make your work a lot easier. :wink: