I have implemented a JavaScript program to find the lowest score and remove it from a collection.
var types=['exam','homework','quiz']
for (student_id = 0; student_id < 800; student_id++){
for(type = 0; type < 3; type++){
var r = {'student_id':student_id, 'type':types[type], 'minscore':{'$min':'$scores'}};
db.scores.remove(r);
}
}
However, I am encountering the following error:
WriteResult({
"nRemoved" : 0,
"writeError" : {
"code" : 2,
"errmsg" : "unknown operator: $min"
}