Many to many relationship and linked table/collection

To set up a many to many relationship in MongoDB you should set up a relationship table:

Courses: [{name: algebra, id: 3}, {name: bio, id: 4}, {name: PE, id: 5}]

Students: [{name: billy, id 1}, {name: shelly: id2}]

Student_Courses: [{courseId: 3, studentId: 1}, {courseId: 4, studentId: 1}, {courseId: 4, studentId: 2} ]