finish metrics script. current total: unregistered: 180931 registered:

52101 active: 4182 (@Slappybag)
This commit is contained in:
Tyler Renelle
2013-06-14 16:56:42 -04:00
parent 6d05651b66
commit 67b2174c3d

View File

@@ -1,4 +1,11 @@
// mongo habitrpg ./migrations/metrics.js
load('./node_modules/moment/moment.js');
var
today = +new Date,
twoWeeksAgo = +moment().subtract(14, 'days');
corrupt = {
$or: [
{lastCron: {$exists:false}},
@@ -16,12 +23,20 @@ var
{ 'auth.local': { $exists: true }},
{ 'auth.facebook': { $exists: true }}
]
},
active = {
$or: [
{ 'auth.local': { $exists: true }},
{ 'auth.facebook': { $exists: true }}
],
$where: function(){
return this.history && this.history.exp && this.history.exp.length > 14;
},
'lastCron': {$gt: twoWeeksAgo}
};
print('corrupt: ' + db.users.count(corrupt));
print('unregistered: ' + db.users.count(un_registered));
print('registered: ' + db.users.count(registered));
// TODO active users
// - history > 14 entries
// - lastCron < 14d
print('active: ' + db.users.count(active));