Sample Data

The datasets used in examples throughout this guide.

Previous | Index | Next: 04 - Document Stages


projects Collection

This is the primary collection used in most examples. It represents research and management projects with review scores and funding sources.

db.projects.insertMany([
  {
    _id: ObjectId("...1"),
    title: "Production Planning Systems",
    type: "REQUEST_PROJECT",
    state: "APPROVED",
    fundings: [
      {
        debitorName: "SAP Microsystems",
        amount: NumberLong(10000)
      }
    ],
    reviews: [4, 4, 3, 3, 4]
  },
  {
    _id: ObjectId("...2"),
    title: "Finite Elements",
    type: "RESEARCH_PROJECT",
    state: "IN_APPROVEMENT",
    fundings: [
      {
        debitorName: "TU Wien",
        amount: NumberLong(5000)
      },
      {
        debitorName: "Oracle Systems",
        amount: NumberLong(15000)
      }
    ],
    reviews: [5, 5, 3]
  },
  {
    _id: ObjectId("...3"),
    title: "Simulation Systems",
    type: "MANAGEMENT_PROJECT",
    state: "IN_APPROVEMENT",
    fundings: [
      {
        debitorName: "Sun Microsystems",
        amount: NumberLong(45000)
      },
      {
        debitorName: "Oracle Systems",
        amount: NumberLong(15000)
      }
    ],
    reviews: [4, 5, 4, 5, 5]
  }
]);

Document Structure at a Glance

project
├── _id          (ObjectId)
├── title        (String)
├── type         (String: REQUEST_PROJECT | RESEARCH_PROJECT | MANAGEMENT_PROJECT)
├── state        (String: APPROVED | IN_APPROVEMENT)
├── fundings[]   (Array of objects)
│   ├── debitorName  (String)
│   └── amount       (NumberLong)
└── reviews[]    (Array of Numbers — rating scores)

subprojects Collection

Used in the $lookup examples. Each subproject belongs to a project (referenced by project_id).

db.subprojects.insertMany([
  {
    _id: ObjectId("...11"),
    appliedResearch: NumberInt(20),
    focusResearch: NumberInt(80),
    project_id: ObjectId("...1"),
    title: "ERP SAP",
    facility: {
      name: "Software Engineering Institute",
      _id: ObjectId("...23")
    }
  },
  {
    _id: ObjectId("...12"),
    appliedResearch: NumberInt(40),
    focusResearch: NumberInt(60),
    project_id: ObjectId("...1"),
    title: "Web-based Systems",
    facility: {
      name: "Database Institute",
      _id: ObjectId("...45")
    }
  },
  {
    _id: ObjectId("...13"),
    appliedResearch: NumberInt(80),
    focusResearch: NumberInt(10),
    project_id: ObjectId("...2"),
    title: "Embedded Systems"
  },
  {
    _id: ObjectId("...14"),
    appliedResearch: NumberInt(10),
    focusResearch: NumberInt(80),
    project_id: ObjectId("...3"),
    title: "API Design SAP"
  }
]);

sales Collection

Used in the 13 - Accumulator Operators examples.

db.sales.insertMany([
  { item: "abc1", price: 10, category: "BOARD_GAME" },
  { item: "jkl",  price: 20, category: "PC_GAME" },
  { item: "xyz",  price: 5,  category: "BOOK" },
  { item: "abc2", price: 10, category: "BOOK" },
  { item: "abc3", price: 10, category: "BOARD_GAME" }
]);

Now that we have our data, let’s start working with it in 04 - Document Stages.