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?>
@JvmName(name = "acosByProperty")
open fun <Context : Any> acos(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "acosNonNull")
fun <Context : Any> acos(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "acosNonNullByField")
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?>
@JvmName(name = "acoshByProperty")
open fun <Context : Any> acosh(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "acoshNonNull")
fun <Context : Any> acosh(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "acoshNonNullByField")
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?>
@JvmName(name = "asinByProperty")
open fun <Context : Any> asin(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "asinNonNull")
fun <Context : Any> asin(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "asinNonNullByField")
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?>
@JvmName(name = "asinhByProperty")
open fun <Context : Any> asinh(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "asinhNonNull")
fun <Context : Any> asinh(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "asinhNonNullByField")
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?>
@JvmName(name = "atanByProperty")
open fun <Context : Any> atan(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "atanNonNull")
fun <Context : Any> atan(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "atanNonNullByField")
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?>
@JvmName(name = "atanhByProperty")
open fun <Context : Any> atanh(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "atanhNonNull")
fun <Context : Any> atanh(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "atanhNonNullByField")
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?>
@JvmName(name = "cosByProperty")
open fun <Context : Any> cos(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "cosNonNull")
fun <Context : Any> cos(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "cosNonNullByField")
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?>
@JvmName(name = "coshByProperty")
open fun <Context : Any> cosh(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "coshNonNull")
fun <Context : Any> cosh(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "coshNonNullByField")
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¶
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 child field of a field of type BsonDocument.
Example
open operator fun <Context : Any, Result> Value<Context, Collection<Result>>.get(index: Value<Context, Int>): Value<Context, Result>
open operator fun <Context : Any, Result> Value<Context, Collection<Result>>.get(index: Field<Context, Int>): Value<Context, Result>
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?>
@JvmName(name = "sinByProperty")
open fun <Context : Any> sin(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "sinNonNull")
fun <Context : Any> sin(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "sinNonNullByField")
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?>
@JvmName(name = "sinhByProperty")
open fun <Context : Any> sinh(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "sinhNonNull")
fun <Context : Any> sinh(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "sinhNonNullByField")
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?>
@JvmName(name = "tanByProperty")
open fun <Context : Any> tan(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "tanNonNull")
fun <Context : Any> tan(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "tanNonNullByField")
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?>
@JvmName(name = "tanhByProperty")
open fun <Context : Any> tanh(value: KProperty1<Context, Double?>): Value<Context, Double?>
@JvmName(name = "tanhNonNull")
fun <Context : Any> tanh(value: Value<Context, Double>): Value<Context, Double>
@JvmName(name = "tanhNonNullByField")
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.
Refers to a field child of the current field, with no compile-time safety.
unsafeCast¶
Overwrites the represented type of this value.
This method can be useful to bypass type checks.
Example
If a field has changed type over time, the DTO will use the newer type. However, you may still want to write a query using the old type: