Created
November 2, 2012 16:46
-
-
Save shussekaido/4002606 to your computer and use it in GitHub Desktop.
M101 HW 2.2
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
// Assign your query to a variable. To quote the assignment: "select homework documents, sort by student and then by score" | |
var students = db.grades./* YOUR CODE */ | |
// Create a variable to track student_id so we can detect when it changes | |
var id = ""; | |
// Loop through our query results. Each document in the query is passed into a function as 'student' | |
students.forEach(function (student) { | |
if (id !== student.student_id) { // Check if the student_id is new | |
db.grades./* YOUR CODE */ // If your 'students' query is correct the document with the lowest homework score is here. Remove it. | |
id = student.student_id; // Track student_id | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment