Query about facet function

facet_stage = {
“$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”
}
}]
}
}
What does above facet_stage means??Can you please guide me with the explanation

It would be hard to give better explications that https://docs.mongodb.com/manual/reference/operator/aggregation/facet/

Hi @SUDARSHAN_SHARMA_64757,

Please let me know if you still have any questions.

Kanika