After upgrading to MongoDB 2.4, I encountered an issue with a map function that uses db, as mentioned in the release notes. The release notes suggest refactoring, but I am unsure about the best approach to take.
The part of the function that is no longer working looks like this:
function map() {
var student = db.student.findOne(this.student_id);
var school = db.school.findOne(this.school_id);
...
emit({
bcg_id: student.bcg_id,
...
I am confused about how to assign the document from the 'student' collection to the 'student' variable now that db is deprecated.
Any advice on what steps to take?