Example 1 — Sample Data
Imagine four numbers stored as x: 0, 1, -1, and 2. We save them in a collection named hyperbolic.
db.hyperbolic.insertMany([
{ _id: 1, x: 0 },
{ _id: 2, x: 1 },
{ _id: 3, x: -1 },
{ _id: 4, x: 2 }
]); How the Data Is Stored in MongoDB
After the insert, MongoDB keeps four documents in hyperbolic. Run find() to see them:
db.hyperbolic.find() Read those documents like this:
| Field in MongoDB | Example | Plain English |
|---|---|---|
_id | 1 … 4 | Document id for this lesson |
x | 1 or -1 | Input value for $cosh (radians) |
Hyperbolic cosine curve (sketch):
y
| /
| /
| ____/____ ← minimum at cosh(0) = 1
| / \
| /
+--------------→ x
-2 -1 0 1 2
cosh(-1) = cosh(1) (mirror / even) How It Works
- Insert once.
insertManyadds four documents with differentxvalues. - MongoDB stores numbers as written. Including the negative
-1. - find() shows the same shape. What you inserted is what you get back—ready for
$coshnext.

