Class CountOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.CountOperation
- All Implemented Interfaces:
AggregationOperation
,FieldsExposingAggregationOperation
Encapsulates the aggregation framework
We recommend to use the static factory method
$count
-operation. We recommend to use the static factory method
Aggregation.count()
instead of creating instances of this class
directly.- Since:
- 1.10
- Author:
- Mark Paluch
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation
-
Constructor Summary
ConstructorDescriptionCountOperation
(String fieldName) Creates a newCountOperation
given the fieldName field name. -
Method Summary
Modifier and TypeMethodDescriptionReturns the fields exposed by theAggregationOperation
.Return the MongoDB operator that is used for thisAggregationOperation
.org.bson.Document
toDocument
(AggregationOperationContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.mongodb.core.aggregation.AggregationOperation
toPipelineStages
Methods inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation
inheritsFields
-
Constructor Details
-
CountOperation
Creates a newCountOperation
given the fieldName field name.- Parameters:
fieldName
- must not be null or empty.
-
-
Method Details
-
toDocument
Description copied from interface:AggregationOperation
- Specified by:
toDocument
in interfaceAggregationOperation
- Parameters:
context
- theAggregationOperationContext
to operate within. Must not be null.- Returns:
- the Document
-
getOperator
Description copied from interface:AggregationOperation
Return the MongoDB operator that is used for thisAggregationOperation
. Aggregation operations should implement this method to avoid document rendering.- Specified by:
getOperator
in interfaceAggregationOperation
- Returns:
- the operator used for this
AggregationOperation
.
-
getFields
Description copied from interface:FieldsExposingAggregationOperation
Returns the fields exposed by theAggregationOperation
.- Specified by:
getFields
in interfaceFieldsExposingAggregationOperation
- Returns:
- will never be null.
-