Files
habitica/migrations/20150906_groups_remove_empty.js
Matteo Pagliazzi 0330735e8e fix migrations
2015-09-09 22:32:12 +02:00

21 lines
374 B
JavaScript

/*
* Remove empty private groups
*/
var mongo = require('mongoskin');
var dbserver = 'url';
var dbname = 'name';
var db = mongo.db(dbserver + '/' + dbname + '?auto_reconnect');
var dbGroups = db.collection('groups');
console.log('Begins work on db');
dbGroups.findEach({
memberCount: 0,
}, {_id: 1}, function(err, res){
if(err) throw err;
console.log(res);
});