Module spring.data.mongodb
Class UnwindOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.UnwindOperation
- All Implemented Interfaces:
AggregationOperation,FieldsExposingAggregationOperation,FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation
public class UnwindOperation
extends Object
implements AggregationOperation, FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation
Encapsulates the aggregation framework
$unwind-operation.
We recommend to use the static factory method Aggregation.unwind(String) instead of creating instances of
this class directly.
- Since:
- 1.3
- Author:
- Thomas Darimont, Oliver Gierke, Mark Paluch, Christoph Strobl
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfacestatic final classBuilder for fluentUnwindOperationcreation.Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation -
Constructor Summary
ConstructorsConstructorDescriptionUnwindOperation(Field field) Creates a newUnwindOperationfor the givenField.UnwindOperation(Field field, boolean preserveNullAndEmptyArrays) Creates a newUnwindOperationusing Mongo 3.2 syntax.UnwindOperation(Field field, Field arrayIndex, boolean preserveNullAndEmptyArrays) Creates a newUnwindOperationusing Mongo 3.2 syntax. -
Method Summary
Modifier and TypeMethodDescriptionReturns the fields exposed by theAggregationOperation.Return the MongoDB operator that is used for thisAggregationOperation.static UnwindOperation.PathBuilderGet a builder that allows creation ofLookupOperation.org.bson.DocumenttoDocument(AggregationOperationContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.mongodb.core.aggregation.AggregationOperation
toPipelineStagesMethods inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation
inheritsFields
-
Constructor Details
-
UnwindOperation
Creates a newUnwindOperationfor the givenField.- Parameters:
field- must not be null.
-
UnwindOperation
Creates a newUnwindOperationusing Mongo 3.2 syntax.- Parameters:
field- must not be null.preserveNullAndEmptyArrays- true to output the document if path is null, missing or array is empty.- Since:
- 1.10
-
UnwindOperation
Creates a newUnwindOperationusing Mongo 3.2 syntax.- Parameters:
field- must not be null.arrayIndex- optional field name to expose the field array index, must not be null.preserveNullAndEmptyArrays- true to output the document if path is null, missing or array is empty.- Since:
- 1.10
-
-
Method Details
-
toDocument
Description copied from interface:AggregationOperation- Specified by:
toDocumentin interfaceAggregationOperation- Parameters:
context- theAggregationOperationContextto operate within. Must not be null.- Returns:
- the Document
-
getOperator
Description copied from interface:AggregationOperationReturn the MongoDB operator that is used for thisAggregationOperation. Aggregation operations should implement this method to avoid document rendering.- Specified by:
getOperatorin interfaceAggregationOperation- Returns:
- the operator used for this
AggregationOperation.
-
getFields
Description copied from interface:FieldsExposingAggregationOperationReturns the fields exposed by theAggregationOperation.- Specified by:
getFieldsin interfaceFieldsExposingAggregationOperation- Returns:
- will never be null.
-
newUnwind
Get a builder that allows creation ofLookupOperation.- Returns:
- Since:
- 1.10
-