diff --git a/bin/mongodb/puzzle-migrate-vote-disable.js b/bin/mongodb/puzzle-migrate-vote-disable.js index f4734b3bd6..84d338fc7a 100644 --- a/bin/mongodb/puzzle-migrate-vote-disable.js +++ b/bin/mongodb/puzzle-migrate-vote-disable.js @@ -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;