I am in the database design phase of my MERN app (I use Next.js instead of just React.js). My app is basically an LMS (learning management system where professors can put assignments, tests, resources, etc etc. Students can access those, do it and submit them. I am trying to think about how do I go about the Gradebook. Every student will have a grade in all of the classes they are in. I am using MongoDB. How do I design the gradebook? I can't just put a 'grade' or 'marks' field in the Course database because all students in that class for that assignment will have different grades. Please help. If you were to design an LMS, how would you set up the "Grades" to work?
Asked
Active
Viewed 206 times
1 Answers
0
Data structure:
db={
"students": [
{
"_id": "1",
"class_id": "5",
"name": "Sam"
},
{
"_id": "2",
"class_id": "5",
"name": "Tom"
}
],
"classes": [
{
"_id": "5",
"grade": 6,
"room": "A-2"
}
],
"teachers": [
{
"_id": "1",
"name": "John"
},
{
"_id": "2",
"name": "kyle"
}
],
"items": [
{
"_id": "1",
"learning_type": "MATH",
"item_type": "TEST",
"teacher_id": "1"
},
{
"_id": "2",
"learning_type": "HISTORY",
"item_type": "ASSIGNMENT",
"teacher_id": "1"
},
{
"_id": "3",
"learning_type": "ENGLISH",
"item_type": "RESOURCE",
"teacher_id": "2"
}
],
"gradebook": [
{
"_id": "1",
"test_id": "2",
"student_id": "1",
"item_id": "1",
"score": 80,
"isChecked": true
},
{
"_id": "2",
"test_id": "2",
"student_id": "2",
"item_id": "1",
"score": 0,
"isChecked": false
}
]
}
If you want to ask how to use this data structure to query specific data, please give the query parameters and expected output, I will add the query function.

YuTing
- 6,555
- 2
- 6
- 16
-
Thank you. So far what I had for my collections(tables) are Courses, Professors, Students. Courses have course_id, name, professor_id, assignment_id[ ], test_quizzes_id[ ], announcement_id[ ], resources_id[ ], student_id[ ]. The Professor collection has professor_id, first_name, last_name, email, course_id[ ]. The Student collection has student_id, first_name, last_name, email, course_id[ ]. This is why my layout looks like so far. If you want to see the front-end you can find it at: https://osm-sagarsubedi.vercel.app. Do you think I can still incorporate the Gradebook database as you said? – SSubedi Oct 11 '21 at 21:11
-
I think your data structure is fine. Your gradebook may need several Id to relate to other collections. You can ask another question in stackoverflow if you have problem about query. Put some test data and exprected result. – YuTing Oct 12 '21 at 00:52