public class FacetOperation extends Object implements FieldsExposingAggregationOperation
$facet-operation. AggregationOperations 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. FacetOperation cannot be used with nested pipelines containing GeoNearOperation,
OutOperation and FacetOperation. Aggregation.facet() instead of creating instances of this class
directly.| Modifier and Type | Class and Description |
|---|---|
static class |
FacetOperation.FacetOperationBuilder
Builder for
FacetOperation by adding existing and the new pipeline of AggregationOperation to the
new FacetOperation. |
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation| Modifier and Type | Field and Description |
|---|---|
static FacetOperation |
EMPTY
Empty (initial)
FacetOperation. |
| Constructor and Description |
|---|
FacetOperation()
Creates a new
FacetOperation. |
| Modifier and Type | Method and Description |
|---|---|
FacetOperation.FacetOperationBuilder |
and(AggregationOperation... operations)
Creates a new
FacetOperation.FacetOperationBuilder to append a new facet using operations. |
ExposedFields |
getFields()
Returns the fields exposed by the
AggregationOperation. |
String |
getOperator()
Return the MongoDB operator that is used for this
AggregationOperation. |
org.bson.Document |
toDocument(AggregationOperationContext context)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinheritsFieldstoPipelineStagespublic static final FacetOperation EMPTY
FacetOperation.public FacetOperation()
FacetOperation.public FacetOperation.FacetOperationBuilder and(AggregationOperation... operations)
FacetOperation.FacetOperationBuilder to append a new facet using operations. FacetOperation.FacetOperationBuilder takes a pipeline of AggregationOperation to categorize documents into a
single facet.operations - must not be null or empty.public org.bson.Document toDocument(AggregationOperationContext context)
AggregationOperationtoDocument in interface AggregationOperationcontext - the AggregationOperationContext to operate within. Must not be null.public String getOperator()
AggregationOperationAggregationOperation. Aggregation operations should
implement this method to avoid document rendering.getOperator in interface AggregationOperationAggregationOperation.public ExposedFields getFields()
FieldsExposingAggregationOperationAggregationOperation.getFields in interface FieldsExposingAggregationOperationCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.