Package dev.morphia.aggregation.stages
Class AddFields
- java.lang.Object
-
- dev.morphia.aggregation.stages.Stage
-
- dev.morphia.aggregation.stages.AddFields
-
public class AddFields extends Stage
Adds new fields to documents. $addFields outputs documents that contain all existing fields from the input documents and newly added fields.The $addFields stage is equivalent to a $project stage that explicitly specifies all existing fields in the input documents and adds the new fields.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AddFields()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AddFields
addFields()
Creates a new AddFields stageAddFields
field(String name, dev.morphia.aggregation.expressions.impls.Expression value)
Add a field to the stagedev.morphia.aggregation.expressions.impls.DocumentExpression
getDocument()
static AddFields
of()
Deprecated, for removal: This API element is subject to removal in a future version.useaddFields()
-
Methods inherited from class dev.morphia.aggregation.stages.Stage
aggregation, stageName
-
-
-
-
Method Detail
-
addFields
public static AddFields addFields()
Creates a new AddFields stage- Returns:
- the new stage
- Since:
- 2.2
-
of
@Deprecated(forRemoval=true) public static AddFields of()
Deprecated, for removal: This API element is subject to removal in a future version.useaddFields()
Creates a new AddFields stage to bind field- Returns:
- the new stage
-
field
public AddFields field(String name, dev.morphia.aggregation.expressions.impls.Expression value)
Add a field to the stage- Parameters:
name
- the name of the new fieldvalue
- the value expression- Returns:
- this
-
getDocument
@MorphiaInternal public dev.morphia.aggregation.expressions.impls.DocumentExpression getDocument()
- Returns:
- the fields
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-