In one of our documents, the field awards
is structured as below:
"awards" :
{
"oscars" : [
{"award": "bestAnimatedFeature", "result": "won"},
{"award": "bestMusic", "result": "won"},
{"award": "bestPicture", "result": "nominated"},
{"award": "bestSoundEditing", "result": "nominated"},
{"award": "bestScreenplay", "result": "nominated"}
],
"wins" : 56,
"nominations" : 86,
"text" : "Won 2 Oscars. Another 56 wins and 86 nominations."
}
We need a query to use in a find() command that will retrieve all movies in this collection which either won or were nominated for the best picture award. In essence, the goal is to tally the instances where the 'award' within the 'oscars' array is "bestPicture".