Created
November 7, 2021 17:46
-
-
Save Deeptiman/847d152f5c00ed09f27e74922dd3c05e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.movies.aggregate( | |
// Pipeline | |
[ | |
// Stage 1 | |
{ | |
$match: { | |
// conditional query | |
"imdb.rating": { | |
$lt: 7.5 | |
} | |
} | |
}, | |
// Stage 2 | |
{ | |
$group: { | |
_id: "total_vote", | |
vote_count: { | |
$sum: "$imdb.votes" | |
} | |
} | |
}, | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment