In Chapter 2: User-Facing Backend
Ticket: Faceted Search
Here is implemented code about the aggregation facet.
const facetStage = {
$facet: {
runtime: [
{
$bucket: {
groupBy: "$runtime",
boundaries: [0, 60, 90, 120, 180],
default: "other",
output: {
count: { $sum: 1 },
},
},
},
],
rating: [
{
$bucket: {
groupBy: "$metacritic",
boundaries: [0, 50, 70, 90, 100],
default: "other",
output: {
count: { $sum: 1 },
},
},
},
],
movies: [
{
$addFields: {
title: "$title",
},
},
],
},
}
I passed the lab, but I don’t know how it works and what I get when I finish the lab without any explanation to this stage. I need more explanation about this or received committed to explaining in the next chapter.
I don’t think in the previous lecture, I have gotten all enough about “basic aggregation” to understand that string