Module spring.data.mongodb
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.ReplaceRootOperationBuilderNested classes/interfaces inherited from interface org.springframework.data.mongodb.core.aggregation.FieldsExposingAggregationOperation
FieldsExposingAggregationOperation.InheritsFieldsAggregationOperation -
Constructor Summary
ConstructorsConstructorDescriptionReplaceWithOperation(ReplaceRootOperation.Replacement replacement) Creates new instance ofReplaceWithOperation. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReplaceWithOperationreplaceWithValue(Object value) Creates new instance ofReplaceWithOperation.static ReplaceWithOperationreplaceWithValueOf(Object value) org.bson.DocumenttoDocument(AggregationOperationContext context) Methods inherited from class org.springframework.data.mongodb.core.aggregation.ReplaceRootOperation
builder, getFields, getOperator, getReplacementMethods 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
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:
toDocumentin interfaceAggregationOperation- Overrides:
toDocumentin classReplaceRootOperation- Parameters:
context- theAggregationOperationContextto operate within. Must not be null.- Returns:
- the Document
-