AddFields class
$addFields
aggregation stage
Stage description.
$addFields
appends new fields to existing documents. You can include one
or more $addFields
stages in an aggregation pipeline.
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 $addFields
, use with
$concatArrays
(ConcatArrays).
Example:
Dart code
AddFields({
'totalHomework': Sum(Field('homework')),
'totalQuiz': Sum(Field('quiz'))
}).build()
Equivalent mongoDB aggregation stage:
{
$addFields: {
totalHomework: { $sum: "$homework" } ,
totalQuiz: { $sum: "$quiz" }
}
}
https://docs.mongodb.com/manual/reference/operator/aggregation/addFields/
- Inheritance
-
- Object
- AggregationStage
- AddFields
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