mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 19:47:03 +00:00
add count habits mongo script, for the kickstarter blog post
This commit is contained in:
parent
e4565c3f9b
commit
5e7187dbcd
1 changed files with 13 additions and 0 deletions
13
migrations/20130204_count_habits.js
Normal file
13
migrations/20130204_count_habits.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// %mongo server:27017/dbname underscore.js my_commands.js
|
||||
// %mongo server:27017/dbname underscore.js --shell
|
||||
var habits = 0,
|
||||
dailies = 0,
|
||||
todos = 0,
|
||||
registered = { $or: [ { 'auth.local': { $exists: true } }, { 'auth.facebook': { $exists: true} } ]};
|
||||
|
||||
db.user.find(registered).forEach(function(u){
|
||||
//TODO this isn't working??
|
||||
habits += _.where(u.tasks, {type:'habit'}).length;
|
||||
dailies += _.where(u.tasks, {type:'daily'}).length;
|
||||
todos += _.where(u.tasks, {type:'todo'}).length;
|
||||
})
|
||||
Loading…
Reference in a new issue