Last active
October 12, 2015 11:48
-
-
Save puentesarrin/4022294 to your computer and use it in GitHub Desktop.
Course M101 - Help to solve Homework 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
db.grades.aggregate({ | |
'$group': {'_id': '$student_id'}}).forEach(function(i) { | |
var x = db.grades.find({ student_id: i._id, type: 'homework' }).sort({ score: 1 })[0]; | |
db.grades.remove({ _id: x._id }); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment