querydrill

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
FieldTypePresentExample
_idnumberalways101
namestringalways"Denish"
emailstringalways"denish101@example…"
agenumberalways21
countrystringalways"India"
statusstringalways"active"
rolestringalways"admin"
skillsarrayalways
addressobjectalways
citystringalways"Surat"
countrystringalways"India"
ordersarrayalways
_idnumberalways1011
productstringalways"Laptop"
pricenumberalways1000
statusstringalways"completed"
createdAtdatealways2025-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
FieldTypePresentExample
_idnumberalways1
userIdnumberalways108
statusstringalways"completed"
createdAtdatealways2025-11-05
itemsarrayalways
productstringalways"Keyboard"
categorystringalways"Electronics"
pricenumberalways100
quantitynumberalways1
ratingnumber50%4
discountnumber57%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
FieldTypePresentExample
_idnumberalways1
productstringalways"Laptop"
categorystringalways"Electronics"
pricenumberalways1000
inStocknumberalways0
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.

Query it now →Start the course