MongoDB request DSL • opensavvy.ktmongo.dsl.aggregation.operators • ArrayValueOperators • average
average¶
Returns the average of the elements in the array.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val averageScore: Double,
)
players.updateManyWithPipeline {
set {
Player::averageScore set Player::scores.average()
}
}
External resources¶
Returns the average of the elements in the array.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val averageScore: Double,
)
players.updateManyWithPipeline {
set {
Player::averageScore set Player::scores.average()
}
}
External resources¶
Returns the average of the elements in the array.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val averageScore: Double,
)
players.updateManyWithPipeline {
set {
Player::averageScore set Player::scores.average()
}
}
External resources¶
Returns the average of the elements in the array.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val averageScore: Double,
)
players.updateManyWithPipeline {
set {
Player::averageScore set Player::scores.average()
}
}
External resources¶
Returns the average of the elements in the array.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val averageScore: Double,
)
players.updateManyWithPipeline {
set {
Player::averageScore set Player::scores.average()
}
}
External resources¶
Deprecated (with error)¶
Computing the average of 0 elements makes no sense, you should specify the elements to average as the receiver or as arguments.