I have a parameter in my Lesson Schema, “students”. The “students” parameter is an array of studentSchema containing, enrolledDate, student_id (referencing the User Collection) and an attendance parameter.
i am thinking of indexing the student_id parameter in the students array, in the Lesson Schema.
Reason being when a student logs in he/she should be able to see all the lessons he/she needs to attend and it makes sense to me that i should index this parameter so that when i query with $in the dbms would retrieve the lessons much quicker.
Not so confident in my understanding of how mongodb dbms works. Please comment. Thank you.