Package dev.morphia.aggregation.stages
Class ReplaceRoot
- java.lang.Object
-
- dev.morphia.aggregation.stages.Stage
-
- dev.morphia.aggregation.stages.ReplaceRoot
-
public class ReplaceRoot extends Stage
Replaces the input document with the specified document. The operation replaces all existing fields in the input document, including the _id field.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReplaceRoot()
protected
ReplaceRoot(dev.morphia.aggregation.expressions.impls.Expression expression)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ReplaceRoot
field(String name, dev.morphia.aggregation.expressions.impls.Expression expression)
Adds a new fielddev.morphia.aggregation.expressions.impls.DocumentExpression
getDocument()
dev.morphia.aggregation.expressions.impls.Expression
getValue()
static ReplaceRoot
replaceRoot()
Creates a new stagestatic ReplaceRoot
replaceRoot(dev.morphia.aggregation.expressions.impls.Expression expression)
Creates a new stage to replace the root with the given expression.static ReplaceRoot
with()
Deprecated, for removal: This API element is subject to removal in a future version.usereplaceRoot()
static ReplaceRoot
with(dev.morphia.aggregation.expressions.impls.Expression expression)
Deprecated, for removal: This API element is subject to removal in a future version.-
Methods inherited from class dev.morphia.aggregation.stages.Stage
aggregation, stageName
-
-
-
-
Method Detail
-
replaceRoot
public static ReplaceRoot replaceRoot()
Creates a new stage- Returns:
- the new stage
- Since:
- 2.2
-
replaceRoot
public static ReplaceRoot replaceRoot(dev.morphia.aggregation.expressions.impls.Expression expression)
Creates a new stage to replace the root with the given expression. This expression must evaluate to a document. No further fields can be added to this stage.- Parameters:
expression
- the document expression- Returns:
- the new stage
- Since:
- 2.2
-
with
@Deprecated(forRemoval=true) public static ReplaceRoot with()
Deprecated, for removal: This API element is subject to removal in a future version.usereplaceRoot()
Creates a new stage- Returns:
- the new stage
-
with
@Deprecated(forRemoval=true) public static ReplaceRoot with(dev.morphia.aggregation.expressions.impls.Expression expression)
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new stage to replace the root with the given expression. This expression must evaluate to a document. No further fields can be added to this stage.- Parameters:
expression
- the document expression- Returns:
- the new stage
-
field
public ReplaceRoot field(String name, dev.morphia.aggregation.expressions.impls.Expression expression)
Adds a new field- Parameters:
name
- the field nameexpression
- the value expression- Returns:
- this
-
getDocument
@Nullable @MorphiaInternal public dev.morphia.aggregation.expressions.impls.DocumentExpression getDocument()
- Returns:
- the expression
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
getValue
@Nullable @MorphiaInternal public dev.morphia.aggregation.expressions.impls.Expression getValue()
- Returns:
- the expression
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-