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¶
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¶
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¶
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¶
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¶
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¶
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¶
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¶
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¶
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¶
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 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¶
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¶
The hyperbolic sine 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 x: Double,
val y: Double,
)
collection.aggregate()
.set {
Trigonometry::y set sinh(of(Trigonometry::x))
}
External resources¶
tan¶
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¶
The hyperbolic tangent 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 x: Double,
val y: Double,
)
collection.aggregate()
.set {
Trigonometry::y set tanh(of(Trigonometry::x))
}
External resources¶
toDegrees¶
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
TrigonometryValueOperators.toRadians: Opposite operation
toRadians¶
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
TrigonometryValueOperators.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.
Refers to a field child of the current field, with no compile-time safety.