-2
type: homework and student_id
を使用して最小スコアを削除したいと考えています。例については 、 student_id :0
は、2つの値がタイプすなわち持っている:宿題 を、私は削除する少なくとも1すなわちMongoDBの "student id"と "homework"と比較して、スコアを最小にするにはどうすればよいですか?
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb579" }, "student_id" : 0, "type" : "homework", "score" : 14.8504576811645 }
マイファイル:
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb577" }, "student_id" : 0, "type" : "exam", "score" : 54.6535436362647 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb578" }, "student_id" : 0, "type" : "quiz", "score" : 31.95004496742112 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb579" }, "student_id" : 0, "type" : "homework", "score" : 14.8504576811645 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb57a" }, "student_id" : 0, "type" : "homework", "score" : 63.98402553675503 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb57b" }, "student_id" : 1, "type" : "exam", "score" : 74.20010837299897 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb57c" }, "student_id" : 1, "type" : "quiz", "score" : 96.76851542258362 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb57d" }, "student_id" : 1, "type" : "homework", "score" : 21.33260810416115 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb57e" }, "student_id" : 1, "type" : "homework", "score" : 44.31667452616328 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb57f" }, "student_id" : 2, "type" : "exam", "score" : 19.88180838833524 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb580" }, "student_id" : 2, "type" : "quiz", "score" : 1.528220212203968 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb581" }, "student_id" : 2, "type" : "homework", "score" : 60.9750047106029 }
{ "_id" : { "$oid" : "50906d7fa3c412bb040eb582" }, "student_id" : 2, "type" : "homework", "score" : 97.75889721343528 }
ありがとうございます..変更のみ... db.getCollection( 'collectionName')です。remove( –
私は100万のレコードを削除するにはどうすればstudent_idを増やすのですか? –
「タイプ:宿題」を持つすべての生徒でスコアの最低値を削除する場合は、検索クエリでstudent_id条件を削除するだけです。 – karthi