Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.aggregation.operatorsTrigonometryValueOperatorscos

cos

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

The cosine of a value that is measured in radians.

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::sideB set (of(cos(Triangle::angleA) * of(Triangle::hypotenuse)))
    }

External resources