The dataset
Every lesson example and every exercise runs against this data. It is generated from a fixed seed, so it is identical in your browser and in mine — and "restore" puts it back exactly, not approximately.
Nothing here is uploaded and nothing is shared. The whole dataset is built in your tab when the page loads, and your queries never leave it.
Two different things are called “orders”.Each user carries a small embedded orders array — a couple of entries with product, price and status, used by the array-update drills. The separate orders collection is the real one: 200 documents with userId, createdAt and a nesteditems array, and it is what almost every aggregation drill uses. They are not linked, and their ids do not match: user 101 has embedded orders1011 and 1012, while its documents in theorders collection have quite different ids. Each drill says which one it means; when a query comes back empty, this is usually why.
users
30 documents · 13 top-level fields| Field | Type | Present | Example |
|---|
_id | number | always | 101 |
name | string | always | "Denish" |
email | string | always | "denish101@example…" |
age | number | always | 21 |
country | string | always | "India" |
status | string | always | "active" |
role | string | always | "admin" |
skills | array | always | |
address | object | always | |
city | string | always | "Surat" |
country | string | always | "India" |
orders | array | always | |
_id | number | always | 1011 |
product | string | always | "Laptop" |
price | number | always | 1000 |
status | string | always | "completed" |
createdAt | date | always | 2025-01-01 |
One users document
{
"_id": 101,
"name": "Denish",
"email": "denish101@example.com",
"age": 21,
"country": "India",
"status": "active",
"role": "admin",
"skills": [
"Node.js",
"Kafka"
],
"address": {
"city": "Surat",
"country": "India"
},
"orders": [
{
"_id": 1011,
"product": "Laptop",
"price": 1000,
"status": "completed"
},
{
"_id": 1012,
"product": "Notebook",
"price": 5,
"status": "pending"
}
],
"createdAt": "2025-01-01T00:00:00.000Z"
}orders
200 documents · 7 top-level fields| Field | Type | Present | Example |
|---|
_id | number | always | 1 |
userId | number | always | 108 |
status | string | always | "completed" |
createdAt | date | always | 2025-11-05 |
items | array | always | |
product | string | always | "Keyboard" |
category | string | always | "Electronics" |
price | number | always | 100 |
quantity | number | always | 1 |
rating | number | 50% | 4 |
discount | number | 57% | 7 |
One orders document
{
"_id": 1,
"userId": 108,
"status": "completed",
"createdAt": "2025-11-05T00:07:00.000Z",
"items": [
{
"product": "Keyboard",
"category": "Electronics",
"price": 100,
"quantity": 1
},
{
"product": "Desk Chair",
"category": "Furniture",
"price": 250,
"quantity": 1
},
{
"product": "Keyboard",
"category": "Electronics",
"price": 100,
"quantity": 3
},
{
"product": "Speaker",
"category": "Audio",
"price": 200,
"quantity": 3
}
],
"rating": 4
}products
11 documents · 5 top-level fields| Field | Type | Present | Example |
|---|
_id | number | always | 1 |
product | string | always | "Laptop" |
category | string | always | "Electronics" |
price | number | always | 1000 |
inStock | number | always | 0 |
One products document
{
"_id": 1,
"product": "Laptop",
"category": "Electronics",
"price": 1000,
"inStock": 0
}Fields that are not always there
These are deliberate. Arithmetic on a field that is missing does not do what you expect, which is what $ifNull is for — and you cannot see any of this from one sample document.
orders.rating — present on 50% of documentsorders.discount — present on 57% of documents