The $sinh operator computes the hyperbolic sine of a number in MongoDB aggregation pipelines. Use it for exponential growth models, physics simulations, and advanced math transformations on numeric data.
01
Hyperbolic Sine
Exponential-style math.
02
Syntax
One expression inside $sinh.
03
sinh(0) = 0
Zero at origin.
04
Odd Function
sinh(-x) = -sinh(x).
05
Use Cases
Growth, physics, stats.
06
vs $sin
Hyperbolic vs circular.
Fundamentals
Definition and Usage
In MongoDB’s aggregation framework, the $sinh operator returns the hyperbolic sine of a numeric expression. The formula is sinh(x) = (ex - e-x) / 2. For example, sinh(0) = 0, sinh(1) ≈ 1.175, and sinh(2) ≈ 3.627. Values grow exponentially as the input moves away from zero.
💡
Beginner Tip
Think of $sinh as MongoDB’s version of JavaScript’s Math.sinh(). Use it inside aggregation expression stages like $project or $addFields, not as a query filter.
Foundation
📝 Syntax
The $sinh operator takes one numeric expression:
mongosh
{ $sinh: <expression> }
Syntax Rules
$sinh — returns the hyperbolic sine of the expression.
<expression> — a field reference, literal, or nested numeric expression.
sinh(0) = 0 — the function passes through the origin.
$sinh is an odd function: sinh(-x) = -sinh(x).
Output can be positive or negative; magnitude grows rapidly for large |x|.
Use inside stages like $project, $addFields, or $set.
If the input is null, the result is null.
⚠️ Exponential Growth Away from Zero
$sinh(0) → 0
$sinh(1) → ≈ 1.175
$sinh(2) → ≈ 3.627
$sinh(3) → ≈ 10.018(grows quickly)
$sinh(-2) → ≈ -3.627(odd function)
💡 $sinh vs $sin vs $asinh
$sinh — hyperbolic sine; grows exponentially; odd function
$sin — circular sine; output -1 to 1; periodic waves; input in radians
$asinh — inverse of $sinh; recovers x from a sinh value
Cheat Sheet
⚡ Quick Reference
Question
Answer
Operator type
Aggregation expression operator (hyperbolic)
Syntax
{ $sinh: <expression> }
Input
Any real number
Output at zero
0
Common stages
$project, $addFields, $set
Zero
{
$sinh: 0
}
Returns 0
Field
{
$sinh: "$x"
}
From document field
Example
{
$sinh: 1
}
≈ 1.175
Null input
{
$sinh: null
}
Returns null
Hands-On
Examples Gallery
Compute hyperbolic sines from stored values, verify the odd-function property, and explore exponential growth with $sinh.
📚 Exponential Data
Use an exponentialData collection and compute $sinh for each numeric field with $project.
Sample Input Documents
Suppose you have an exponentialData collection with a numeric field x:
$sinh(0) = 0. $sinh(-1) equals the negative of $sinh(1), confirming the odd-function property.
Applications
🚀 Use Cases
Exponential growth modeling — analyze processes with rapid increase, such as population or reaction rates.
Financial forecasting — model non-linear changes in metrics when hyperbolic transforms apply.
Physics and engineering — heat transfer, fluid dynamics, and wave equations involving hyperbolic functions.
Data transformation — preprocess numeric fields for statistical or machine-learning pipelines.
🧠 How $sinh Works
1
MongoDB reads the input
The pipeline evaluates the expression — a field like "$x" or a numeric literal.
Input
2
$sinh applies the hyperbolic formula
MongoDB computes (ex - e-x) / 2 and returns the result.
Transform
3
The result is stored in the pipeline
The hyperbolic sine value is written to the field you define in $project or $addFields.
Output
=
📐
Hyperbolic value ready to use
Use in further math, pair with $cosh, or feed into $asinh for the inverse.
Wrap Up
Conclusion
The $sinh operator brings hyperbolic sine math directly into MongoDB aggregation pipelines. Remember that sinh(0) = 0, the function is odd (sinh(-x) = -sinh(x)), and values grow exponentially for large inputs.
Do not confuse $sinh with circular $sin — they behave very differently. Next in the series: $size.
Use $sinh for exponential-style growth and hyperbolic transforms
Remember sinh(0) = 0 when validating pipeline output
Pair with $cosh when both hyperbolic components are needed
Use $asinh for the inverse when recovering original values
Test with small literals (0, 1, -1) before running on large datasets
❌ Don’t
Confuse $sinh (hyperbolic) with $sin (circular trig)
Expect bounded output like $sin — $sinh grows without limit
Forget that null input returns null
Assume $sinh is even like $cosh — it is odd
Pass very large values without considering overflow in downstream math
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about $sinh
Use these points when computing hyperbolic sines in MongoDB.
5
Core concepts
📐01
Hyperbolic
Exponential math.
Purpose
📝02
{ $sinh: x }
One expression.
Syntax
📏03
sinh(0) = 0
Passes origin.
Rule
🛠04
Odd function
Flips sign.
Property
⚠05
Not $sin
Hyperbolic vs circular.
Important
❓ Frequently Asked Questions
$sinh returns the hyperbolic sine of a numeric value. The formula is sinh(x) = (e^x - e^(-x)) / 2. It is an aggregation expression operator used inside stages like $project and $addFields.
The syntax is { $sinh: <expression> }. The expression can be a field reference like "$x", a literal number, or another numeric expression.
$sin is circular trigonometry (input in radians, output -1 to 1, periodic). $sinh is hyperbolic (any real input, grows exponentially, not periodic). They solve different math problems.
Yes. sinh(-x) equals -sinh(x). In a pipeline, $sinh applied to a negative field returns the negated result of the positive value.
$sinh returns null when the input is null. It does not throw an error.