Example 1 — Sample Data
Imagine a tiny planning collection. Each city has total hours and a task count.
db.planning.insertMany([
{ _id: 1, city: "New York", hours: 80, tasks: 7 },
{ _id: 2, city: "Singapore", hours: 40, tasks: 4 },
{ _id: 3, city: "Berlin", hours: 24, tasks: 3 }
]); How the Data Is Stored in MongoDB
After the insert, MongoDB keeps three documents in planning. Run find() to see them:
db.planning.find() Read those documents like this:
| Field in MongoDB | Value | Plain English |
|---|---|---|
_id | 1 … 3 | Document id for this lesson |
city | "New York", "Singapore", "Berlin" | Plan location |
hours / tasks | numbers | Inputs we will divide |
Expected workdays (hours ÷ 8):
New York 80 ÷ 8 → 10
Singapore 40 ÷ 8 → 5
Berlin 24 ÷ 8 → 3 How It Works
- Insert once.
insertManyadds three planning documents. - Hours differ on purpose. You get clear quotients of 10, 5, and 3.
- find() shows the same shape. Ready for
$dividenext.

