On this page本页内容
$radiansToDegrees¶New in version 4.2.版本4.2中的新功能。
Converts an input value measured in radians to degrees.将以弧度为单位的输入值转换为度。
$radiansToDegrees has the following syntax:语法如下所示:
$radiansToDegrees takes any valid expression that resolves to a number.接受任何解析为数字的有效表达式。
By default 默认情况下,$radiansToDegrees returns values as a double. $radiansToDegrees以双精度返回值。$radiansToDegrees can also return values as a 128-bit decimal as long as the 只要<expression> resolves to a 128-bit decimal value.<expression>解析为128位十进制值,也可以以128位十进制返回值。
For more information on expressions, see Expressions.有关表达式的详细信息,请参阅表达式。
null, NaN, and +/- Infinity¶If the argument resolves to a value of 如果参数解析为null or refers to a field that is missing, $radiansToDegrees returns null. null值或引用缺少的字段,$radiansToDegrees返回null。If the argument resolves to 如果参数解析为NaN, $radiansToDegrees returns NaN. NaN,$radiansToDegrees返回NaN。If the argument resolves to negative or positive infinity, 如果参数解析为负无穷大或正无穷大,则$radiansToDegrees negative or positive infinity respectively.$radiansToDegrees分别为负无穷大或正无穷大。
{ $radiansToDegrees: NaN } |
NaN |
{ $radiansToDegrees: null } |
null |
{ $radiansToDegrees : Infinity} |
Infinity |
{ $radiansToDegrees : -Infinity } |
-Infinity |
The trigonometry collection contains a document that contains three angles measured in radians:trigonometry集合包含一个文档,其中包含三个以弧度测量的角度:
The following aggregation operation uses the 下面的聚合操作使用$radiansToDegrees expression to convert each value to its degree equivalent and add them to the input document using the $addFields pipeline stage.$radiansToDegrees表达式将每个值转换为其等效的度,并使用$addFields管道阶段将它们添加到输入文档中。
The operation returns the following document:该操作将返回以下文档:
Since 由于angle_a, angle_b, and angle_c are stored as 128-bit decimals, the output of $radiansToDegrees is a 128-bit decimal.angle_a、angle_b和angle_c存储为128位十进制数,$radiansToDegrees的输出为128位十进制数。