public class BucketOperation extends BucketOperationSupport<BucketOperation,BucketOperation.BucketOperationOutputBuilder> implements FieldsExposingAggregationOperation
$bucket-operation. Aggregation and $facet. Categorizes incoming documents into
groups, called buckets, based on a specified expression and bucket boundaries. Aggregation.bucket(String) instead of creating instances of
this class directly.BucketOperationSupport| Modifier and Type | Class and Description |
|---|---|
static class |
BucketOperation.BucketOperationOutputBuilder
OutputBuilder implementation for BucketOperation. |
static class |
BucketOperation.ExpressionBucketOperationBuilder
ExpressionBucketOperationBuilderSupport implementation for BucketOperation using SpEL expression
based Output. |
BucketOperationSupport.ExpressionBucketOperationBuilderSupport<B extends BucketOperationSupport.OutputBuilder<B,T>,T extends BucketOperationSupport<T,B>>, BucketOperationSupport.OperationOutput, BucketOperationSupport.Output, BucketOperationSupport.OutputBuilder<B extends BucketOperationSupport.OutputBuilder<B,T>,T extends BucketOperationSupport<T,B>>, BucketOperationSupport.OutputsFieldsExposingAggregationOperation.InheritsFieldsAggregationOperation| Constructor and Description |
|---|
BucketOperation(AggregationExpression groupByExpression)
Creates a new
BucketOperation given a group-by expression. |
BucketOperation(Field groupByField)
Creates a new
BucketOperation given a group-by field. |
| Modifier and Type | Method and Description |
|---|---|
BucketOperation.BucketOperationOutputBuilder |
andOutput(AggregationExpression expression)
Creates a new
BucketOperationSupport given an AggregationExpression to add an output field to the
resulting bucket documents. |
BucketOperation.BucketOperationOutputBuilder |
andOutput(String fieldName)
Creates a new
BucketOperationSupport given fieldName to add an output field to the resulting
bucket documents. |
BucketOperation.ExpressionBucketOperationBuilder |
andOutputExpression(String expression,
Object... params)
Creates a new
BucketOperationSupport.ExpressionBucketOperationBuilderSupport given a SpEL expression and optional
params to add an output field to the resulting bucket documents. |
protected BucketOperation |
newBucketOperation(BucketOperationSupport.Outputs outputs)
Implementation hook to create a new bucket operation.
|
com.mongodb.DBObject |
toDBObject(AggregationOperationContext context)
|
BucketOperation |
withBoundaries(Object... boundaries)
Configures boundaries and return a new
BucketOperation. |
BucketOperation |
withDefaultBucket(Object literal)
Configures a default bucket literal and return a new
BucketOperation. |
andOutput, andOutputCount, getFieldsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFieldspublic BucketOperation(Field groupByField)
BucketOperation given a group-by field.groupByField - must not be null.public BucketOperation(AggregationExpression groupByExpression)
BucketOperation given a group-by expression.groupByExpression - must not be null.public com.mongodb.DBObject toDBObject(AggregationOperationContext context)
AggregationOperationtoDBObject in interface AggregationOperationtoDBObject in class BucketOperationSupport<BucketOperation,BucketOperation.BucketOperationOutputBuilder>public BucketOperation withDefaultBucket(Object literal)
BucketOperation.literal - must not be null.public BucketOperation withBoundaries(Object... boundaries)
BucketOperation. Existing boundaries are
preserved and the new boundaries are appended.boundaries - must not be null.protected BucketOperation newBucketOperation(BucketOperationSupport.Outputs outputs)
BucketOperationSupportnewBucketOperation in class BucketOperationSupport<BucketOperation,BucketOperation.BucketOperationOutputBuilder>outputs - the outputspublic BucketOperation.ExpressionBucketOperationBuilder andOutputExpression(String expression, Object... params)
BucketOperationSupportBucketOperationSupport.ExpressionBucketOperationBuilderSupport given a SpEL expression and optional
params to add an output field to the resulting bucket documents.andOutputExpression in class BucketOperationSupport<BucketOperation,BucketOperation.BucketOperationOutputBuilder>expression - the SpEL expression, must not be null or empty.params - must not be nullpublic BucketOperation.BucketOperationOutputBuilder andOutput(AggregationExpression expression)
BucketOperationSupportBucketOperationSupport given an AggregationExpression to add an output field to the
resulting bucket documents.andOutput in class BucketOperationSupport<BucketOperation,BucketOperation.BucketOperationOutputBuilder>expression - the SpEL expression, must not be null or empty.public BucketOperation.BucketOperationOutputBuilder andOutput(String fieldName)
BucketOperationSupportBucketOperationSupport given fieldName to add an output field to the resulting
bucket documents. BucketOperationSupport exposes accumulation operations that can be applied to
fieldName.andOutput in class BucketOperationSupport<BucketOperation,BucketOperation.BucketOperationOutputBuilder>fieldName - must not be null or empty.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.