Docs Menu

$acosh (aggregation)

이 페이지의 내용

$acosh

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

$acosh의 구문은 다음과 같습니다.

{ $acosh: <expression> }

$acosh(은)는 1(과)와 +Infinity 사이의 숫자로 확인되는 모든 유효한 표현식을 사용합니다(예: 1 <= value <= +Infinity).

$acosh는 값을 라디안 단위로 반환합니다. 출력 값을 라디안에서 각도로 변환하려면 $radiansToDegrees 연산자를 사용하세요.

기본적으로 $acosh 값은 double로 반환합니다. $acosh<expression>이 128-비트 십진수 값으로 확인되는 한 값을 128-비트 십진수로 반환할 수도 있습니다.

표현식에 대한 자세한 내용은 표현식 연산자를 참조하세요.

If the argument resolves to a value of null or refers to a field that is missing, $acosh returns null. If the argument resolves to NaN, $acosh returns NaN. If the argument resolves to negative infinity, $acosh throws an error. If the argument resolves to Infinity, $acosh returns Infinity. If the argument resolves to a value outside the bounds of [-1, Infinity] inclusive, $acosh throws an error.

예시
결과

{ $acosh: NaN }

NaN

{ $acosh: null }

null

{ $acosh : Infinity}

Infinity

{ $acosh : 0 }

다음과 같은 형식의 출력과 유사한 오류 메시지를 표시합니다.

"errmsg" :
"Failed to optimize pipeline :: caused by :: cannot
apply $acosh to -inf, value must in (1,inf)"

trigonometry 컬렉션에는 2-D 그래프의 x 축을 따라 값을 저장하는 문서가 포함되어 있습니다.

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

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

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

$radiansToDegrees 표현식 은 $acosh 에서 반환된 라디안 값을 해당 값(단위: 도)으로 변환합니다.

이 명령은 다음 출력을 반환합니다.

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

x-coordinate128비트 십진수 로 저장되므로 $acosh 의 출력은 128비트 십진수입니다.

trigonometry 컬렉션에는 2-D 그래프의 x 축을 따라 값을 저장하는 문서가 포함되어 있습니다.

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

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

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

이 명령은 다음 출력을 반환합니다.

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

x-coordinate128비트 십진수 로 저장되므로 $acosh 의 출력은 128비트 십진수입니다.

이 페이지의 내용