Docs 菜单

$asinh (aggregation)

在此页面上

$asinh

Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value.

$asinh 采用以下语法:

{ $asinh: <expression> }

$asinh接受解析为数字的任何有效表达式

$asinh 以弧度为单位返回值。使用 $radiansToDegrees 操作符,将输出值从弧度转换为度数。

默认情况下,$asinh 会以 double 的形式返回值。只要 <expression> 解析为 128 位十进制值, $asinh 也会返回 128 位十进制值

有关表达式的更多信息,请参阅表达式运算符。

If the argument resolves to a value of null or refers to a field that is missing, $asinh returns null. If the argument resolves to NaN, $asinh returns NaN. If the argument resolves to negative or positive infinity, $asinh returns negative or positive infinity respectively.

例子
结果

{ $asinh: NaN }

NaN

{ $asinh: null }

null

{ $asinh : Infinity}

Infinity

{ $asinh : -Infinity }

-Infinity

trigonometry 集合包含一个文档,该文档沿 2-D 图的 x 轴存储值:

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("1")
}

The following aggregation operation uses the $asinh expression to calculate inverse hyperbolic sine of x-coordinate and add it to the input document using the $addFields pipeline stage.

db.trigonometry.aggregate([
{
$addFields : {
"y-coordinate" : {
$radiansToDegrees : { $asinh : "$x-coordinate" }
}
}
}
])

$radiansToDegrees表达式将$asinh返回的弧度值转换为以度为单位的等效值。

该命令返回以下输出:

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("1"),
"y-coordinate" : NumberDecimal("50.49898671052621144221476300417157")
}

由于x-coordinate存储为128位十进制数,因此$asinh的输出为128位十进制数。

trigonometry 集合包含一个文档,该文档沿 2-D 图的 x 轴存储值:

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("1")
}

The following aggregation operation uses the $asinh expression to calculate inverse hyperbolic sine of x-coordinate and add it to the input document using the $addFields pipeline stage.

db.trigonometry.aggregate([
{
$addFields : {
"y-coordinate" : {
$asinh : "$x-coordinate"
}
}
}
])

该命令返回以下输出:

{
"_id" : ObjectId("5c50782193f833234ba90d85"),
"x-coordinate" : NumberDecimal("1"),
"y-coordinate" : NumberDecimal("1.818446459232066823483698963560709")
}

由于x-coordinate存储为128位十进制数,因此$asinh的输出为128位十进制数。

在此页面上