The $asinh operator returns the inverse hyperbolic sine of a number in MongoDB aggregation pipelines. It is the reverse of $sinh and accepts any real number — positive, negative, or zero.
01
Inverse asinh
Reverse of hyperbolic sine.
02
Syntax
One expression inside $asinh.
03
All Reals
Any number is valid input.
04
$project Stage
Add computed fields easily.
05
Use Cases
Stats, signals, transforms.
06
Edge Case
asinh(0) = 0
Fundamentals
Definition and Usage
In MongoDB’s aggregation framework, the $asinh operator computes the inverse hyperbolic sine of a numeric expression. If sinh(y) = x, then asinh(x) = y. For example, $asinh(1) returns approximately 0.881, and $asinh(0) returns 0.
💡
Beginner Tip
Unlike $acosh, $asinh works on any real number including negatives. Think of it as MongoDB’s version of JavaScript’s Math.asinh().
Foundation
📝 Syntax
The $asinh operator takes one numeric expression:
mongosh
{ $asinh: <expression> }
Syntax Rules
$asinh — returns the inverse hyperbolic sine of the expression.
<expression> — can be any real number (positive, negative, or zero).
Use it inside stages like $project, $addFields, or $set.
If the input is null, the result is null.
No domain restriction like $acosh (which requires input ≥ 1).
💡 $asinh vs $acosh
Both are inverse hyperbolic operators, but their input domains differ:
$asinh — accepts any real number (including negatives)
$acosh — requires input ≥ 1
$asinh: -2 → -1.444(valid)
$acosh: -2 → NaN(invalid)
Cheat Sheet
⚡ Quick Reference
Question
Answer
Operator type
Aggregation expression operator (hyperbolic)
Syntax
{ $asinh: <expression> }
Input range
All real numbers
Inverse of
$sinh
Common stages
$project, $addFields, $set
Example
{
$asinh: 1
}
≈ 0.881
Negative
{
$asinh: -2
}
≈ -1.444
Zero
{
$asinh: 0
}
Returns 0
Null input
{
$asinh: null
}
Returns null
Hands-On
Examples Gallery
Compute inverse hyperbolic sine on sample values, including positive, negative, and zero inputs.
📚 Basic Computation
Use a data collection and compute $asinh for each numeric field with $project.
Sample Input Documents
Suppose you have a data collection with a numeric value field:
The asinh transform compresses large values while preserving sign. It is commonly used in statistics and econometrics to handle skewed revenue or count data before averaging.
asinh(0) = 0 is the key edge case. For large inputs, asinh grows slowly (like a log), which makes it useful for compressing extreme values.
Applications
🚀 Use Cases
Data transformation — preprocess numerical values with an inverse hyperbolic sine function before analysis.
Signal processing — transform sensor readings or signals in aggregation pipelines.
Statistical analysis — normalize or stabilize skewed data distributions (asinh transform).
Outlier compression — reduce the impact of extreme values while keeping sign information.
🧠 How $asinh Works
1
MongoDB reads the value
The pipeline evaluates the input — a field like "$value" or a numeric expression.
Input
2
$asinh computes the inverse
MongoDB applies the inverse hyperbolic sine function. Any real number is valid input.
Transform
3
The result is stored in the pipeline
The computed value is written to the field you define in $project or $addFields.
Output
=
📈
Transformed numeric data
Use the result for grouping, averaging, or further pipeline stages.
Wrap Up
Conclusion
The $asinh operator is a versatile hyperbolic math tool in MongoDB aggregation pipelines. It accepts any real number, handles negatives naturally, and is especially useful for statistical transforms and compressing skewed data.
For beginners, remember: asinh(0) = 0, negatives are valid, and pair with $round when you need clean display values.
Use $asinh for skewed data transforms before averaging
Remember asinh(0) = 0 when checking results
Use $round for readable output values
Pair with $sinh to verify round-trip calculations
Handle null inputs with $ifNull when needed
❌ Don’t
Confuse $asinh with $asin (different functions)
Apply the same domain rules as $acosh (asinh has no minimum)
Use $asinh as a query filter outside expressions
Expect linear growth for large inputs (asinh grows logarithmically)
Forget to test with zero and negative values
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about $asinh
Use these points when working with hyperbolic math in MongoDB.
5
Core concepts
📈01
Inverse asinh
Reverse of $sinh.
Purpose
📝02
Simple Syntax
{ $asinh: expr }
Syntax
📏03
All Reals
Any number is valid.
Domain
🔢04
Odd Function
asinh(-x) = -asinh(x).
Property
⚠05
Zero Edge Case
asinh(0) = 0.
Special
❓ Frequently Asked Questions
$asinh returns the inverse hyperbolic sine (arc hyperbolic sine) of a number. It is the reverse of $sinh and is used in aggregation expression stages like $project and $addFields.
The syntax is { $asinh: <expression> }. The expression can be a field reference like "$value", a literal number, or another numeric expression.
$asinh accepts any real number — positive, negative, or zero. Unlike $acosh, there is no minimum domain restriction.
asinh(0) equals 0. This is a useful edge case when validating pipeline results.
$asinh returns null when the input is null. It does not throw an error.