Created
September 1, 2013 06:34
-
-
Save ppillip/6402709 to your computer and use it in GitHub Desktop.
3주차 콘솔에서 바로 실행하는 방법 scores 배열안에 순서가 보장된다는 전제 입니다. 그렇지 않다면 type 이 homework 인 넘의 index 부터 찾아야겠지요? ㅋ
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.students.find({}).forEach(function(a){ | |
if(a.scores[2].score > a.scores[3].score){ | |
a.scores.splice(3,1); | |
}else{ | |
a.scores.splice(2,1); | |
} | |
db.students.save(a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scores 배열 2,3 번 type이 homework 라고 되어있다고 전제!!