Created
July 3, 2018 18:41
-
-
Save marianoqueirel/97b91844b17fcc3d287ad0d37d8894da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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