$asinh (aggregation)
$asinh
Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value.
$asinh
采用以下语法:{ $asinh: <expression> } $asinh
以弧度为单位返回值。使用$radiansToDegrees
操作符,将输出值从弧度转换为度数。默认情况下,
$asinh
会以double
的形式返回值。只要<expression>
解析为 128 位十进制值,
$asinh
也会返回 128 位十进制值。
有关表达式的更多信息,请参阅表达式运算符。
行为
null
、NaN
和 +/- Infinity
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.
例子 | 结果 |
---|---|
|
|
|
|
|
|
|
|
例子
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") }
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") }