Skip to content

Instantly share code, notes, and snippets.

@mrlynn
Created July 11, 2023 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlynn/bca1b8490e7ce250627e4f4d634f25b8 to your computer and use it in GitHub Desktop.
Save mrlynn/bca1b8490e7ce250627e4f4d634f25b8 to your computer and use it in GitHub Desktop.
[
{
$match: {
rated: "TV-PG",
},
},
{
$match:
/**
* query: The query in MQL.
*/
{
year: {
$gt: 1965,
},
},
},
{
$project: {
title: 1,
"tomatoes.viewer.rating": 1,
},
},
{
$group: {
_id: "avgRating",
averageViewerRatingOfTVPG: {
$avg: "$tomatoes.viewer.rating",
},
},
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment