MongoDB request DSL • opensavvy.ktmongo.dsl.aggregation.operators • ArithmeticValueOperators • abs
abs¶
The absolute value of a number.
If the value is null
or NaN
, it is returned unchanged.
Example¶
class Sensor(
val name: String,
val startTemp: Int,
val endTemp: Int,
val diffTemp: Int,
)
collection.updateManyWithPipeline(filter = { Sensor::diffTemp.isNull() }) {
set {
Sensor::diffTemp set abs(of(Sensor::startTemp) - of(Sensor::endTemp))
}
}