Class Facet
- java.lang.Object
-
- dev.morphia.aggregation.experimental.stages.Stage
-
- dev.morphia.aggregation.experimental.stages.Facet
-
public class Facet extends Stage
Processes multiple aggregation 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.The $facet stage allows you to create multi-faceted aggregations which characterize data across multiple dimensions, or facets, within a single aggregation stage. Multi-faceted aggregations provide multiple filters and categorizations to guide data browsing and analysis. Retailers commonly use faceting to narrow search results by creating filters on product price, manufacturer, size, etc.
Input documents are passed to the $facet stage only once. $facet enables various aggregations on the same set of input documents, without needing to retrieve the input documents multiple times.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Facet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Facet
facet()
Creates a new facet stageFacet
field(String name, Stage... stages)
Adds a field to the facetMap<String,List<Stage>>
getFields()
static Facet
of()
Deprecated, for removal: This API element is subject to removal in a future version.usefacet()
-
Methods inherited from class dev.morphia.aggregation.experimental.stages.Stage
aggregation, stageName
-
-
-
-
Method Detail
-
facet
public static Facet facet()
Creates a new facet stage- Returns:
- the new stage
- Since:
- 2.2
-
of
@Deprecated(forRemoval=true) public static Facet of()
Deprecated, for removal: This API element is subject to removal in a future version.usefacet()
Creates a new facet stage- Returns:
- the new stage
-
field
public Facet field(String name, Stage... stages)
Adds a field to the facet- Parameters:
name
- the field namestages
- the pipeline defining the field- Returns:
- this
-
-