Looking for help implementing the populate() function without using mongoose within the code snippet below:
`
course.students.forEach(async (student, i) => {
const s = await Student.findById(student._id);
console.log(s.toObject()); // successfully retrieves student data
course.students[i] = s; // encounter issue here
});
console.log(course.json());
`
Why does the assignment not work when trying to update the students array with fetched data? Any insights would be appreciated!
Thank you! :)