Encapsulates the aggregation framework
$facet
-operation.
Facet of
AggregationOperation
s to be used in an
Aggregation
. Processes multiple
AggregationOperation
pipelines within a single stage on the same set of input documents. Each sub-pipeline
has its own field in the output document where its results are stored as an array of documents.
FacetOperation
enables various aggregations on the same set of input documents, without needing to retrieve
the input documents multiple times.
As of MongoDB 3.4,
FacetOperation
cannot be used with nested pipelines containing
GeoNearOperation
,
OutOperation
and
FacetOperation
.
We recommend to use the static factory method
Aggregation.facet()
instead of creating instances of this class
directly.