Many to many relationship and linked table/collection

In my opinion, for instance, in a scenario with lots of students and courses, it’s more efficient to include the course ID in the student’s data rather than including all student IDs in the course data. This way, considering that a student might have fewer courses compared to the number of students in a course, it’s more practical to link them by including the course ID in the student’s information.