Lab-$group and accumulators

In awards field i found data in this way…
1 win.,2 wins,1 nomination etc…But in lab instructions its mentioned as
Won 13 Oscars
Won 1 Oscar
I am bit confused…with this…please clarify?
I have used split function and then filtered only oscar winner documents…I got total document count:2154 …is this process right?

Don’t assume the content of a database is the same for all documents.

If the lab instructions mentioned Won 13 Oscars and Won 1 Oscar, base your work following those instructions. If they would have been wrong others would have find the error and the error would have been fixed.

in the Lab it is given as Hint (Won 13 Oscars, Won 1 Oscar ), read it carefully and think how you can use the given hint to filter the documents. If Split is not giving you desired outcome, you may want to use some other query operator. Good luck!!

Sharad has pointed out exactly the trap I fell into by not reading the question properly. We’re not looking for movies which have won 1 Oscar or which have won 13 Oscars, we’re looking for movies which have won at least 1 Oscar. The hint just gives you an idea of how you can use the content of the awards field to determine a movie’s Oscar-winning status.

I really want to give you a gentle nudge in the right direction but I don’t want to break any rules by giving you too much of the answer, so would it be an acceptable compromise to tell you that you’re looking for a query operator which can match a field value against a regular expression? And that if you’re not familiar with regular expressions, you should bookmark this site: https://www.regular-expressions.info/ (it’s really handy, I refer to it every time I need to use a regular expression).

Good luck :+1:

2 Likes

Thank you all…for your helpful replies…

Thank you for clarifying my doubt on content of database…

Thank you…I also had i an idea of using regular expressions to tackle this problem…but not confident enough to use this …but thank you for providing useful link to practice regex…

1 Like

That’s how we learn.

If you are not trying something you have not done before you are not improving.

1 Like

Yes…I too think in the same way…learning through our mistakes

1 Like

@Simon_39939

Perfect “nudge” and well within the Forum guidelines. Thanks.:wink:

1 Like

Thanks David. I want to help my fellow students when I can (after all, I may need their help later), so it’s good to know that helping in this way is both helpful and doesn’t break any rules :slight_smile:

Hi Guys,

I am getting following answer which is not available in the choices given:

{ “highest_rating” : 9.6, “lowest_rating” : 4.5, “avg_rating” : 7.490729001584786, “deviation” : 0.653728117401871 }

The number of documents matched for me are 1262.

What am I doing wrong?

@Rajesh_61192

Notice that this is both a SOLVED problem and that it is over 2 months old. If you have a new question, please create a new post. Thanks.

Yes, I noticed that after I posted the question. I have created a new topic. Thanks!

Ragesh i am getting exactly the same answer as you. Did you managed to solve the problem?

Nope not yet. I am pretty sure the regex is correct but I guess I might have to check if the ‘awards’ field itself is present in all the documents or not before applying the regex. This may result into number of matching documents other than 1262 and that would change the final result. If not then I don’t know what will fix the issue.

this post was the key.Thank you