Skip to content

What is a Student?

Frank Matranga edited this page Aug 15, 2019 · 2 revisions

In LATE, every user is saved as a Student document in the students collection in the database. Although MongoDB does not have set schemas for documents, we use the NodeJS package Mongoose which allows us to define schemas for documents and model them as Javascript objects, as well as handling validation and other useful things.

The Student model can be found in /server/api/students/students.model.js. Here are some of the most important fields it has:

  • a unique _id
  • the student's first and last name
  • the student's RCS ID (NOT THEIR RIN)
  • other profile info like their major and graduation year
  • the school semesters they are on campus
  • their setup statuses for each setup step
  • integrations they've given us like their phone number, Discord account tokens, and Google tokens
  • Notice that we do NOT store sensitive data like RINs or SIS passwords.

Thanks to Mongoose. the Student model also has its own methods that make it very easy to get data associated with a specific student. For example, if we have a given student document student1 we can get their courses with student1.getCoursesForTerm(termCode) or maybe their upcoming assignments with student1.getUserAssignments({ start: new Date() });

Mongoose also lets us add "virtuals", basically fake fields that are not saved on the document but can be generated from other document fields, such as display_name which either returns something like "Frank Matranga '22" or "matraf" depending on what data the student has submitted so far.