Created
November 5, 2012 17:30
-
-
Save jesusangelm/4018638 to your computer and use it in GitHub Desktop.
borrar el registro de la tarea con la nota mas baja de cada estudiante en la BD MongoDB
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
require "mongo" | |
connection = Mongo::Connection.new("localhost", 27017) | |
db = connection.db("students") | |
coll = db.collection("grades") | |
199.times do |n| | |
doc = coll.find("student_id" => n, "type" => "homework").sort(:score => :asc).limit(1) | |
doc.each { |i| coll.remove(i) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment