AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

$greesToRadians (표현식 연산자)

$degreesToRadians

도 단위로 측정된 입력 값을 라디안으로 변환합니다.

$degreesToRadians 의 구문은 다음과 같습니다:

{ $degreesToRadians: <expression> }

$degreesToRadians takes any valid expression that resolves to a number.

By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the <expression> resolves to a 128-bit decimal value.

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

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

예시
결과

{ $degreesToRadians: NaN }

NaN

{ $degreesToRadians: null }

null

{ $degreesToRadians : Infinity}

Infinity

{ $degreesToRadians : -Infinity }

-Infinity

trigonometry 컬렉션에는 도 단위로 측정된 세 개의 각도가 포함된 문서가 포함되어 있습니다.

{
"angle_a" : Decimal128("53.13010235415597870314438744090659"),
"angle_b" : Decimal128("36.86989764584402129685561255909341"),
"angle_c" : Decimal128("90")
}

The following aggregation operation uses the $degreesToRadians expression to convert each value to its radian equivalent and add them to the input document using the $addFields pipeline stage.

db.trigonometry.aggregate([
{
$addFields: {
"angle_a_rad" : { $degreesToRadians : "$angle_a"},
"angle_b_rad" : { $degreesToRadians : "$angle_b"},
"angle_c_rad" : { $degreesToRadians : "$angle_c"}
}
}
])

연산은 다음 문서를 반환합니다.

{
"_id" : ObjectId("5c50aec71c75c59232b3ede4"),
"angle_a" : Decimal128("53.13010235415597870314438744090660"),
"angle_b" : Decimal128("36.86989764584402129685561255909341"),
"angle_c" : Decimal128("90"),
"angle_a_rad" : Decimal128("0.9272952180016122324285124629224290"),
"angle_b_rad" : Decimal128("0.6435011087932843868028092287173227"),
"angle_c_rad" : Decimal128("1.570796326794896619231321691639752")
}

Since angle_a, angle_b, and angle_c are stored as 128-bit decimals, the output of $degreesToRadians is a 128-bit decimal.

이 페이지 평가하기

이 페이지의 내용