Skip to content

Instantly share code, notes, and snippets.

@marianoqueirel
Created July 3, 2018 18:41
Show Gist options
  • Save marianoqueirel/97b91844b17fcc3d287ad0d37d8894da to your computer and use it in GitHub Desktop.
Save marianoqueirel/97b91844b17fcc3d287ad0d37d8894da to your computer and use it in GitHub Desktop.
Student.find(search)
.populate('sections')
.then(students => {
return students.filter(student => {
let flag = false;
student.sections.forEach(section => {
if (section.year === req.query.year) {
flag = true;
console.log(flag);
}
})
return flag;
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment