Created
March 26, 2015 19:42
-
-
Save fbiville/87f7f181fe622edda1e7 to your computer and use it in GitHub Desktop.
M101J-HW2.2 - using yet-to-be-taught aggregation framework
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
var cursor = db.grades.aggregate([{$group: {_id: "$student_id", minScore: {$min:"$score"}}}]); | |
while (cursor.hasNext()) { | |
var doc = cursor.next(); | |
db.grades.remove({student_id: doc["_id"], score: doc["minScore"]}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment