Class ReplaceWithOperation
java.lang.Object
org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation
org.springframework.data.mongodb.core.aggregation.ReplaceWithOperation
- All Implemented Interfaces:
AggregationOperation
,FieldsExposingAggregationOperation
Encapsulates the aggregation framework
The operation replaces all existing fields including the
$replaceRoot
-operation. The operation replaces all existing fields including the
id
field with @{code $replaceWith}. This way it is
possible to promote an embedded document to the top-level or specify a new document.- Since:
- 3.0
- Author:
- Christoph Strobl
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation
ReplaceRootOperation.Replacement, ReplaceRootOperation.ReplaceRootDocumentOperation, ReplaceRootOperation.ReplaceRootDocumentOperationBuilder, ReplaceRootOperation.ReplaceRootOperationBuilder
Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation
-
Constructor Summary
ConstructorDescriptionReplaceWithOperation
(ReplaceRootOperation.Replacement replacement) Creates new instance ofReplaceWithOperation
. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReplaceWithOperation
replaceWithValue
(Object value) Creates new instance ofReplaceWithOperation
.static ReplaceWithOperation
replaceWithValueOf
(Object value) org.bson.Document
toDocument
(AggregationOperationContext context) Methods inherited from class org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation
builder, getFields, getOperator, getReplacement
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
-
ReplaceWithOperation
Creates new instance ofReplaceWithOperation
.- Parameters:
replacement
- must not be null.
-
-
Method Details
-
replaceWithValue
Creates new instance ofReplaceWithOperation
.- Parameters:
value
- must not be null.- Returns:
- new instance of
ReplaceWithOperation
.
-
replaceWithValueOf
- Parameters:
value
- must not be null.- Returns:
- new instance of
ReplaceWithOperation
.
-
toDocument
Description copied from interface:AggregationOperation
- Specified by:
toDocument
in interfaceAggregationOperation
- Overrides:
toDocument
in classReplaceRootOperation
- Parameters:
context
- theAggregationOperationContext
to operate within. Must not be null.- Returns:
- the Document
-