TrigonometryValueOperators¶
interface TrigonometryValueOperators : ValueOperators
Operators to perform trigonometric and geometric operators.
To learn more about aggregation operators, see AggregationOperators.
Inheritors¶
Properties¶
context¶
@LowLevelApi
abstract override val context: BsonContext
The strategy used when converting from KProperty1 to Field.
field¶
Converts a Kotlin property into a Field.
Functions¶
acos¶
@JvmName(name = "acosByField")
open fun <Context : Any> acos(value: Field<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
acosh¶
@JvmName(name = "acoshByField")
open fun <Context : Any> acosh(value: Field<Context, Double?>): Value<Context, Double?>
The inverse hyperbolic cosine (hyperbolic arc cosine) of a value, in radians.
The value must be in the range 1..∞.
If the value is null or NaN, it is returned unchanged.
Example
class Trigonometry(
val name: String,
val x: Double,
val y: Double,
)
collection.aggregate()
.set {
Trigonometry::y set acosh(of(Trigonometry::x))
}
External resources
asin¶
@JvmName(name = "asinByField")
open fun <Context : Any> asin(value: Field<Context, Double?>): Value<Context, Double?>
The inverse sine (arc sine) 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 asin(of(Triangle::sideA) / of(Triangle::hypotenuse))
}
External resources
asinh¶
@JvmName(name = "asinhByField")
open fun <Context : Any> asinh(value: Field<Context, Double?>): Value<Context, Double?>
The inverse hyperbolic sine (hyperbolic arc sine) of a value, in radians.
If the value is null or NaN, it is returned unchanged.
Example
class Trigonometry(
val name: String,
val x: Double,
val y: Double,
)
collection.aggregate()
.set {
Trigonometry::y set asinh(of(Trigonometry::x))
}
External resources
atan¶
@JvmName(name = "atanByField")
open fun <Context : Any> atan(value: Field<Context, Double?>): Value<Context, Double?>
The inverse tangent (arc tangent) of a value, 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::angleA set atan(of(Triangle::sideB) / of(Triangle::sideA))
}
External resources
atanh¶
@JvmName(name = "atanhByField")
open fun <Context : Any> atanh(value: Field<Context, Double?>): Value<Context, Double?>
The inverse hyperbolic tangent (hyperbolic arc tangent) 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 Trigonometry(
val name: String,
val x: Double,
val y: Double,
)
collection.aggregate()
.set {
Trigonometry::y set atanh(of(Trigonometry::x))
}
External resources
cos¶
@JvmName(name = "cosByField")
open fun <Context : Any> cos(value: Field<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
cosh¶
@JvmName(name = "coshByField")
open fun <Context : Any> cosh(value: Field<Context, Double?>): Value<Context, Double?>
The hyperbolic cosine of a value that is measured in radians.
If the value is null or NaN, it is returned unchanged.
Example
class Trigonometry(
val name: String,
val angle: Double,
val cosh: Double,
)
collection.aggregate()
.set {
Trigonometry::cosh set cosh(of(Trigonometry::angle))
}
External resources
div¶
open operator fun <Context : Any, Root, Child> Value<Context, Root>.div(field: Field<Root, Child>): Value<Context, Child>
@JvmName(name = "divFieldReceiver")
open operator fun <Context : Any, Root, Child> Field<Context, Root>.div(field: Field<Root, Child>): Value<Context, Child>
@JvmName(name = "divResultReceiver")
inline operator fun <Context : Any, Root, Child> Root.div(field: Field<Root, Child>): Value<Context, Child>
open operator fun <Context : Any, Root, Child> Value<Context, Root>.div(field: KProperty1<Root, Child>): Value<Context, Child>
Refers to field as a nested field of the current value.
Examples
class User(
val name: String,
)
class Data(
val users: List<User>,
val userNames: List<Int>,
)
data.aggregate()
.set {
Data::userNames set Data::users.map { it / User::name }
}
External resources
get¶
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
of¶
Refers to a field within an aggregation value.
Example
Refers to a Kotlin value within an aggregation value.
Example
Refers to a BsonType within an aggregation value.
Example
sin¶
@JvmName(name = "sinByField")
open fun <Context : Any> sin(value: Field<Context, Double?>): Value<Context, Double?>
The sine 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 (sin(of(Trigonometry::angleA)) * of(Trigonometry::hypotenuse))
}
External resources
sinh¶
@JvmName(name = "sinhByField")
open fun <Context : Any> sinh(value: Field<Context, Double?>): Value<Context, Double?>
tan¶
@JvmName(name = "tanByField")
open fun <Context : Any> tan(value: Field<Context, Double?>): Value<Context, Double?>
The tangent 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 (tan(of(Trigonometry::angleA) * of(Trigonometry::sideA)))
}
External resources
tanh¶
@JvmName(name = "tanhByField")
open fun <Context : Any> tanh(value: Field<Context, Double?>): Value<Context, Double?>
toDegrees¶
@JvmName(name = "toDegreesFieldReceiver")
open fun <Context : Any> Field<Context, Double>.toDegrees(): Value<Context, Double>
Converts an angle in radians to an angle in degrees.
Example
class Trigonometry(
val angleADeg: Double,
val angleARad: Double,
)
collection.updateManyWithPipeline {
set {
Trigonometry::angleADeg set of(Trigonometry::angleARad).toDegrees()
}
}
External resources
See also
toRadians: Opposite operation
toRadians¶
@JvmName(name = "toRadiansFieldReceiver")
open fun <Context : Any> Field<Context, Double>.toRadians(): Value<Context, Double>
Converts an angle in degrees to an angle in radians.
Example
class Trigonometry(
val angleADeg: Double,
val angleARad: Double,
)
collection.updateManyWithPipeline {
set {
Trigonometry::angleARad set of(Trigonometry::angleADeg).toRadians()
}
}
External resources
See also
toDegrees: Opposite operation
unsafe¶
Refers to a field child of the current field, with no compile-time safety.
open infix fun <Root, Child> KProperty1<Root, *>.unsafe(child: KProperty1<*, Child>): Field<Root, Child>
Refers to a field child of the current field, without checking that it is a field available on the current object.
Refers to a field child of the current field, without checking that it is a field available on the current object.
Refers to a field child of the current field, without checking that it is a field available on the current object.
Refers to a field child of the current field, without checking that it is a field available on the current object.