$asin (Arcsine)

Last updated: 2026-10-09

$asin (Arcsine)

$asin returns the arcsine of a number, with the result expressed in radians. The input must be between -1 and 1. It is used to recover an angle from a sine value or in coordinate transforms. A null or missing argument yields null; input outside [-1, 1] throws an error because no real angle exists for it. Convert the radian result to degrees with $radiansToDegrees. $asin is the inverse of $sin: $sin($asin(x)) equals x.

CategoryMath
MongoDB Version1.0+
Example Languagemongosh (Shell)

📝 Syntax

{ $asin: <numeric-expression> }

⚙️ Parameters

numeric valueA numeric expression between -1 and 1.

Returns:The arcsine in radians; null when null or missing, error outside [-1, 1]

▶ Example

Run the commands below in your local mongosh (requires a running mongod):

// $asin: recover an angle (radians) from a sine value
db.trig.aggregate([
  { $project: {
      angleRad: { $asin: '$sinValue' }
  } }
])

Output:

{ '_id': 1, 'angleRad': 1.5707963267948966 }
{ '_id': 2, 'angleRad': 0.5235987755982989 }

📌 Notes

More hands-on cases coming soon.

📚 Related Tutorials

❓ FAQ

QWhat is the input range of $asin?
AIt must be between -1 and 1; values outside throw.
QDoes $asin return radians or degrees?
ARadians; use $radiansToDegrees for degrees.
QWhat is $asin(1)?
AIt is π/2, the radian measure of 90 degrees, about 1.5708.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏