unset puzzle vote.sum

pull/2465/head
Thibault Duplessis 2016-12-11 22:22:57 +01:00
parent 0c0d06e627
commit bebe108b46
1 changed files with 4 additions and 1 deletions

View File

@ -3,7 +3,7 @@ var puzzles = db.puzzle;
modified = 0;
puzzles.find({
'vote.ratio': {'$exists': false}
'vote.ratio': {$exists: false}
}).forEach(function(p) {
puzzles.update({
_id: p._id
@ -11,6 +11,9 @@ puzzles.find({
$set: {
"vote.ratio": NumberInt(100*(p.vote.up - p.vote.down)/(p.vote.up + p.vote.down)),
"vote.nb": NumberInt(p.vote.up + p.vote.down)
},
$unset: {
'vote.sum': true
}
});
modified += 1;