I recently upgraded to MongoDB 2.4 and as referenced in the release notes, am having an issue with a map function that makes use of db. The release notes recommend refactoring, but I am unclear as to what route I need to take.
The now non-working piece of the function is as follows:
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 unclear on how to pass the document from the 'student' collection to the 'student' variable now that db is deprecated.
Any recommendations?