public static class AggregationGroupField.Builder extends Object
AggregationGroupField
.
This AggregationGroupField.Builder
does not support a build() method or
support chaining of method calls. Instead each builder method returns a
AggregationGroupField
. This is to more closely match the
semantics of the group operator which cannot build complex structures for
each field.
Constructor and Description |
---|
AggregationGroupField.Builder(String fieldName)
Creates a new Builder.
|
Modifier and Type | Method and Description |
---|---|
AggregationGroupField |
addToSet(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$addToSet operator to accumulate the unique values of the
fieldRef. |
AggregationGroupField |
all(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$push operator to accumulate all of the values seen from the
fieldRef. |
AggregationGroupField |
as(String operator,
int value)
Constructs a new
AggregationGroupField object that uses the
custom operator to aggregate all of the values seen from the
fieldRef. |
AggregationGroupField |
as(String operator,
String fieldRef)
Constructs a new
AggregationGroupField object that uses the
custom operator to aggregate all of the values seen from the
fieldRef. |
AggregationGroupField |
average(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$avg operator to compute the average value seen from the
fieldRef. |
AggregationGroupField |
count()
Constructs a new
AggregationGroupField object that uses the
$sum operator to count all of the input documents. |
AggregationGroupField |
first(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$first operator to use the first value seen from the
fieldRef. |
AggregationGroupField |
last(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$last operator to use the last value seen from the
fieldRef. |
AggregationGroupField |
maximum(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$max operator to use the maximum value seen from the
fieldRef. |
AggregationGroupField |
minimum(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$min operator to use the minimum value seen from the
fieldRef. |
AggregationGroupField |
push(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$push operator to accumulate all of the values seen from the
fieldRef. |
AggregationGroupField |
sum(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$sum operator to sum all of the values seen from the
fieldRef. |
AggregationGroupField |
uniqueValuesOf(String fieldRef)
Constructs a new
AggregationGroupField object that uses the
$addToSet operator to accumulate the unique values of the
fieldRef. |
public AggregationGroupField.Builder(String fieldName)
fieldName
- The name of the field to set with the result of the
aggregation/group.public AggregationGroupField addToSet(String fieldRef)
AggregationGroupField
object that uses the
$addToSet operator to accumulate the unique values of the
fieldRef.
This is an alias for uniqueValuesOf(String)
.
fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField all(String fieldRef)
AggregationGroupField
object that uses the
$push operator to accumulate all of the values seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField as(String operator, int value)
AggregationGroupField
object that uses the
custom operator to aggregate all of the values seen from the
fieldRef.operator
- The operator to use.value
- The value to use in the aggregation.AggregationGroupField
object.public AggregationGroupField as(String operator, String fieldRef)
AggregationGroupField
object that uses the
custom operator to aggregate all of the values seen from the
fieldRef.operator
- The operator to use.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField average(String fieldRef)
AggregationGroupField
object that uses the
$avg operator to compute the average value seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField count()
AggregationGroupField
object that uses the
$sum operator to count all of the input documents.AggregationGroupField
object.public AggregationGroupField first(String fieldRef)
AggregationGroupField
object that uses the
$first operator to use the first value seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField last(String fieldRef)
AggregationGroupField
object that uses the
$last operator to use the last value seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField maximum(String fieldRef)
AggregationGroupField
object that uses the
$max operator to use the maximum value seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField minimum(String fieldRef)
AggregationGroupField
object that uses the
$min operator to use the minimum value seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField push(String fieldRef)
AggregationGroupField
object that uses the
$push operator to accumulate all of the values seen from the
fieldRef.
This is an alias for all(String)
.
fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField sum(String fieldRef)
AggregationGroupField
object that uses the
$sum operator to sum all of the values seen from the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.public AggregationGroupField uniqueValuesOf(String fieldRef)
AggregationGroupField
object that uses the
$addToSet operator to accumulate the unique values of the
fieldRef.fieldRef
- The field reference to use. If the fieldRef does
not start with a '$' then one will be added.AggregationGroupField
object.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.