You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodebb/src/upgrades/remove_negative_best_posts.js

23 lines
587 B
JavaScript

/* jslint node: true */
'use strict';
var db = require('../database');
var async = require('async');
var winston = require('winston');
module.exports = {
name: 'Removing best posts with negative scores',
timestamp: Date.UTC(2016, 7, 5),
method: function (callback) {
var batch = require('../batch');
batch.processSortedSet('users:joindate', function (ids, next) {
async.each(ids, function (id, next) {
winston.verbose('processing uid ' + id);
db.sortedSetsRemoveRangeByScore(['uid:' + id + ':posts:votes'], '-inf', 0, next);
}, next);
}, {}, callback);
},
};