$asinh is a MongoDB aggregation expression that returns the inverse hyperbolic sine (arc hyperbolic sine) of a number—the value y such that sinh(y) equals that input. It accepts any real number (positive, negative, or zero).
Remember
$asinh = Math.asinh for aggregation
{ $asinh: <expression> }
input → any real number
output → real number (asinh is odd: asinh(-x) = -asinh(x))
check → asinh(0) = 0
null / missing → null
NaN → NaN
Point $asinh at a field, literal, or nested numeric expression.
Optionally wrap with $round for a shorter display value.
Optionally check with $sinh that you get the original number back.
Piece
Required?
Role
$asinh
Yes
Inverse hyperbolic sine
Expression
Yes
Any real number, field, or nested math
$round
No
Trim floating-point noise for reports
Pseudocode
Pseudocode
for each document:
x = evaluate(expression)
if x is null or missing:
result = null
else if x is NaN:
result = NaN
else:
result = asinh(x) // any real x is fine
emit { ..., field: result }
Reference
Cheat Sheet
Keep these facts handy while writing inverse-hyperbolic-sine expressions.
Topic
Detail
Type
Aggregation expression (not a find filter)
Syntax
{ $asinh: <expression> }
Domain
All real numbers
Odd property
asinh(-x) = -asinh(x)
Zero check
asinh(0) = 0
Round-trip
$sinh({ $asinh: x }) ≈ x
Sample check
asinh(1) ≈ 0.8814
Try it
Live Preview
Watch $asinh turn a number into its inverse hyperbolic sine. Negatives and zero are valid.
Simulates $asinh (same idea as the mongosh examples below).
Result
x = 1
$asinh(x) → 0.881374
{ asinh_value: 0.881374 }
Trace
Worked Walkthrough — asinh(1)
Start with a single number 1. We want the value y where sinh(y) = 1.
Calculation
Document:
{ value: 1 }
Goal: find y such that sinh(y) = 1
$asinh(1) ≈ 0.881373587019543
Check with hyperbolic sine:
sinh(0.881373587019543) ≈ 1 ✓
Also remember:
asinh(0) = 0
asinh(-1) ≈ -0.8814 // odd function
Code
MongoDB Examples
We use three small numbers: 0, 1, and -1. First we store them, then we compute $asinh, then we round for cleaner output. Run these in mongosh after inserting the sample data once.
Example 1 — Sample Data
Imagine three readings: zero, one positive, and one negative. We save each as its own document in a collection named hyperbolic.
Three inputs (easy smoke tests):
value: 0 → asinh should be 0
value: 1 → asinh ≈ 0.8814
value: -1 → asinh ≈ -0.8814 (mirror of +1)
Why these three?
• 0 checks the zero edge case
• 1 is a common positive sample
• -1 shows negatives are valid (unlike $acosh)
How It Works
Insert once.insertMany adds three documents to hyperbolic.
MongoDB stores fields as written. Each value is just a number: 0, 1, or -1.
find() shows the same shape. What you inserted is what you get back—ready for $asinh in the next examples.
Example 2 — Basic $asinh
Goal: compute inverse hyperbolic sine for every stored value.
Same stored documents. Still using values 0, 1, and -1 from Example 1.
Same $asinh first. Full precision is computed, then trimmed.
Round to 4 decimals.$round keeps reports readable (0.8814 instead of a long float).
Easy check. Zero stays 0; positive and negative results stay mirrors.
Edge Cases & Pitfalls
Check these before using $asinh in production pipelines.
name
Do not confuse with $asin
$asin is inverse sine with domain [-1, 1]. $asinh is hyperbolic and accepts any real number.
domain
Negatives are valid
Unlike $acosh, there is no “input must be ≥ 1” rule. Negative values simply return negative results.
null
Null and missing become null
Missing fields return null, not an error. Handle them before math if nulls are invalid in your data.
scale
Growth is slow for large |x|
For large magnitudes, asinh grows roughly like a log. That is useful for compressing outliers, but do not expect linear scaling.
Analysis
Performance Notes
Approach
Cost
Best for
$asinh alone
Per-document math
Simple inverse hyperbolic sine fields
$asinh + $round
Still O(docs)
Readable report columns
$sinh round-trip check
Two math ops
Validating transforms in tests
Trig and hyperbolic expressions are cheap compared with large sorts or joins. Filter early with $match when only some documents need the transform.
Remember
Key Takeaways
Role: inverse hyperbolic sine of any real number.
Domain: no [-1, 1] clamp—negatives are fine.
Pair: reverse of $sinh; not the same as $asin.
Smoke test:asinh(0) = 0.
One line:$asinh answers “which value has this hyperbolic sine?”—for any real input, including negatives and zero.
Frequently Asked Questions
$asinh returns the inverse hyperbolic sine (arc hyperbolic sine) of a number—the value y such that sinh(y) equals that number. Use it inside aggregation expression stages such as $project and $addFields.
Any real number—positive, negative, or zero. Unlike $acosh (input ≥ 1) or $asin (input in [-1, 1]), $asinh has no domain clamp for normal numbers.
asinh(0) equals 0. That makes zero a handy smoke-test when checking pipeline output.
$asinh returns null when the input is null or the field is missing. If the argument is NaN, $asinh returns NaN.
$asin is inverse sine (trig, domain [-1, 1]). $asinh is inverse hyperbolic sine (any real input). Same naming style, different math.
Yes for the math. Think of $asinh as MongoDB’s aggregation version of Math.asinh—run it in the pipeline, not as a standalone find() filter.