2013-06-14 20:56:42 +00:00
|
|
|
// mongo habitrpg ./migrations/metrics.js
|
|
|
|
|
|
|
|
|
|
load('./node_modules/moment/moment.js');
|
|
|
|
|
|
2013-06-14 20:17:41 +00:00
|
|
|
var
|
2013-06-14 20:56:42 +00:00
|
|
|
today = +new Date,
|
|
|
|
|
twoWeeksAgo = +moment().subtract(14, 'days');
|
|
|
|
|
|
2013-06-14 20:17:41 +00:00
|
|
|
corrupt = {
|
|
|
|
|
$or: [
|
|
|
|
|
{lastCron: {$exists:false}},
|
|
|
|
|
{lastCron: 'new'}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
un_registered = {
|
|
|
|
|
"auth.local": {$exists: false},
|
|
|
|
|
"auth.facebook": {$exists: false}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
registered = {
|
|
|
|
|
$or: [
|
|
|
|
|
{ 'auth.local': { $exists: true }},
|
|
|
|
|
{ 'auth.facebook': { $exists: true }}
|
|
|
|
|
]
|
2013-06-14 20:56:42 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
active = {
|
|
|
|
|
$or: [
|
|
|
|
|
{ 'auth.local': { $exists: true }},
|
|
|
|
|
{ 'auth.facebook': { $exists: true }}
|
|
|
|
|
],
|
2013-06-15 17:52:10 +00:00
|
|
|
// $where: function(){
|
|
|
|
|
// return this.history && this.history.exp && this.history.exp.length > 7;
|
|
|
|
|
// },
|
2013-06-14 20:56:42 +00:00
|
|
|
'lastCron': {$gt: twoWeeksAgo}
|
2013-06-14 20:17:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
print('corrupt: ' + db.users.count(corrupt));
|
|
|
|
|
print('unregistered: ' + db.users.count(un_registered));
|
|
|
|
|
print('registered: ' + db.users.count(registered));
|
2013-06-14 20:56:42 +00:00
|
|
|
print('active: ' + db.users.count(active));
|