Class ReplaceRoot
- java.lang.Object
-
- dev.morphia.aggregation.experimental.stages.Stage
-
- dev.morphia.aggregation.experimental.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(Expression expression)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReplaceRoot
field(String name, Expression expression)
Adds a new fieldDocumentExpression
getDocument()
Expression
getValue()
static ReplaceRoot
with()
Creates a new stagestatic ReplaceRoot
with(Expression expression)
Creates a new stage to replace the root with the given expression.-
Methods inherited from class dev.morphia.aggregation.experimental.stages.Stage
getStageName
-
-
-
-
Constructor Detail
-
ReplaceRoot
protected ReplaceRoot(Expression expression)
-
ReplaceRoot
protected ReplaceRoot()
-
-
Method Detail
-
with
public static ReplaceRoot with()
Creates a new stage- Returns:
- the new stage
-
with
public static ReplaceRoot with(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
-
field
public ReplaceRoot field(String name, Expression expression)
Adds a new field- Parameters:
name
- the field nameexpression
- the value expression- Returns:
- this
-
getDocument
public 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
public 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.
-
-