Package dev.morphia.aggregation.stages
Class Set
java.lang.Object
dev.morphia.aggregation.stages.Stage
dev.morphia.aggregation.stages.Set
Adds new fields to documents. $set outputs documents that contain all existing fields from the input documents and newly added fields.
The $set stage is an alias for $addFields.
Both stages are equivalent to a $project stage that explicitly specifies all existing fields in the input documents and adds the new fields.
- Since:
- 2.3
-
Method Summary
-
Method Details
-
set
Creates a new Set stage- Returns:
- the new stage
- MongoDB documentation
- Aggregration Pipeline Stage: $set
- Since server release
- 4.2
-
field
Add a field to the stage- Parameters:
name
- the name of the new fieldvalue
- the value expression- Returns:
- this
-