Skip to content

Database Schemas

rttsai edited this page Nov 27, 2016 · 1 revision

This page uses JSON Schema to the list the database schemas for all objects stored in MongoDB. Click here for a list of guides to JSON Schema.

All objects in the database get assigned an ObjectId the first time the object is saved. All properties of the type ObjectId refer to another object in the database.

#Assignment Schema

{
}

#Class Schema

{
  name: {
    type: String,
    trim: true
  },
  teacher: {
    type: ObjectId,
    ref: 'Teacher'
  },
  students: [{
    type: ObjectId,
    ref: 'Student'
  }],
  leaderboard: [{
    studentAlias: String,
    score: Number
  }]
}

#Student Schema

{
  name: {
    type: String,
    trim: true,
    required: true
  },
  avatarUrl: {
    type: String,
    trim: true
  }
}

#Teacher Schema

{
  name: {
    type: String,
    trim: true,
    required: true
  }
}

#Quest Schema

{
  assignments: {
    type: ObjectId,
    ref: 'Assignment'
  }
}