Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.aggregation.operatorsTrigonometryValueOperatorsacos

acos

open fun <Context : Any> acos(value: Value<Context, Double?>): Value<Context, Double?>

The inverse cosine (arc cosine) of a value, in radians.

The value must be in the range -1..1.

If the value is null or NaN, it is returned unchanged.

Example

class Triangle(
    val name: String,
    val sideA: Double,
    val sideB: Double,
    val hypotenuse: Double,
    val angleA: Double,
)

collection.aggregate()
    .set {
        Triangle::angleA set acos(of(Triangle::sideB) / of(Triangle::hypotenuse))
    }

External resources