Class ReplaceRootOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation
- All Implemented Interfaces:
AggregationOperation
,FieldsExposingAggregationOperation
- Direct Known Subclasses:
ReplaceRootOperation.ReplaceRootDocumentOperation
,ReplaceWithOperation
Encapsulates the aggregation framework
We recommend to use the static factory method
$replaceRoot
-operation. We recommend to use the static factory method
Aggregation.replaceRoot(String)
instead of creating instances
of this class directly.- Since:
- 1.10
- Author:
- Mark Paluch, Christoph Strobl
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Replacement object that results in a replacement document or an expression that results in a document.static class
Encapsulates the aggregation framework$replaceRoot
-operation to result in a composable replacement document.static class
Builder forReplaceRootOperation.ReplaceRootDocumentOperation
to populateReplaceRootOperation.ReplacementDocument
static class
Builder forReplaceRootOperation
.Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation
-
Constructor Summary
ConstructorDescriptionReplaceRootOperation
(AggregationExpression aggregationExpression) Creates a newReplaceRootOperation
given theAggregationExpression
pointing to a document.ReplaceRootOperation
(Field field) Creates a newReplaceRootOperation
given theField
field name.ReplaceRootOperation
(ReplaceRootOperation.Replacement replacement) Creates a newReplaceRootOperation
given theReplaceRootOperation.Replacement
. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a newReplaceRootOperation.ReplaceRootDocumentOperationBuilder
.Returns the fields exposed by theAggregationOperation
.Return the MongoDB operator that is used for thisAggregationOperation
.protected ReplaceRootOperation.Replacement
Obtain theReplaceRootOperation.Replacement
.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
-
ReplaceRootOperation
Creates a newReplaceRootOperation
given theField
field name.- Parameters:
field
- must not be null or empty.
-
ReplaceRootOperation
Creates a newReplaceRootOperation
given theAggregationExpression
pointing to a document.- Parameters:
aggregationExpression
- must not be null.
-
ReplaceRootOperation
Creates a newReplaceRootOperation
given theReplaceRootOperation.Replacement
.- Parameters:
replacement
- must not be null.
-
-
Method Details
-
builder
Creates a newReplaceRootOperation.ReplaceRootDocumentOperationBuilder
.- Returns:
- a new
ReplaceRootOperation.ReplaceRootDocumentOperationBuilder
.
-
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.
-
getReplacement
Obtain theReplaceRootOperation.Replacement
.- Returns:
- never null.
- Since:
- 3.0
-