-
Notifications
You must be signed in to change notification settings - Fork 617
Migrating to 0.7.x
Important: if you're migrating from a version prior to 0.4.0 you should read this before proceeding.
A new field named score has been added with the sorting comments feature at this release. This allows to sort comments according to their score, being calculated as follows: comment.score = comment.upvotes - comment.downvotes (minus).
In order to sort your comments you need to run the following command at your MongoDB shell:
db.comments.find().forEach(function (c) {
var positive = c.votes.filter( function (v) {
return v.value == 'positive';
}).length;
var negative = c.votes.filter( function (v) {
return v.value == 'negative';
}).length;
var score = positive - negative;
db.comments.update( { _id: c._id }, { $set: { score: score } } );
});After this, the score will be set to corresponding number for each comment. And subsequent upvotes and downvotes will modify the comment.score field to reflect this new score.
clauseId has been deprecated as an id is not always required, as well as the prefixed word Clause: for displaying each clause on the law's article.
In order to rename each clauseId to clauseName in your database, run the following command at your MongoDB shell:
db.laws.find().forEach(function (law) {
law.clauses.forEach(function(c) {
c.clauseName = c.clauseId;
delete c.clauseId;
});
db.laws.update( { _id: law._id }, law);
});
Visit our official website - Developed by Democracia en Red and contributors from the world over!