seniorMongoDB

Explain the use of $facet in Aggregation.

Updated May 1, 2026

Short answer

$facet allows for multi-faceted aggregations within a single stage.

Deep explanation

It processes multiple aggregation pipelines in parallel on the same set of input documents. This is great for dashboards needing multiple counts.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More MongoDB interview questions

View all →