Building the Back End Data Store for the Node.js Full Stack Web Application
You have been tasked with building the back end data store for a college enrollment system. The system has three collections: students, courses, and enrollments. Each student can enroll in multiple courses, and each course can have multiple students enrolled in it. The enrollments collection stores the association between students and courses. You need to implement a MongoDB predicate join between the students and enrollments collections, and between the courses and enrollments collections to retrieve a list of enrolled students for each course and a list of enrolled courses for each student.
Mary enrolls in Java, Database, and Math
Ashley enrolls in NODEJS, Math, and Database
Jordan enrolls in Math, Java, and Database
Create a new MongoDB database using the following command:
Create three collections for students, courses, and enrollments using the following commands:
Use the $lookup operator to join the enrollments collection with the students and courses collections to retrieve a list of enrolled courses for each student and a list of enrolled students for each course.