SetStage class
$set
aggregation stage
Stage description
Available since MongoDB version 4.2
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
.
$set
appends new fields to existing documents. You can include one or
more $set stages in an aggregation operation.
To add field or fields to embedded documents (including documents in arrays) use the dot notation.
To add an element to an existing array field with $set
, use with
$concatArrays (ConcatArrays).
Dart code:
SetStage({
'totalHomework': Sum(Field('homework')),
'totalQuiz': Sum(Field('quiz'))
}).build()
Equivalent mongoDB aggregation stage:
{
$set: {
totalHomework: { $sum: "$homework" },
totalQuiz: { $sum: "$quiz" }
}
}
https://docs.mongodb.com/manual/reference/operator/aggregation/set/
- Inheritance
-
- Object
- AggregationStage
- SetStage
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
) → Map< String, Object> -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited