Created
September 14, 2015 07:28
-
-
Save ar2rsawseen/5d1dec271d4506cace81 to your computer and use it in GitHub Desktop.
Get sources from Countly DB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stores = {}; | |
db.stores.find({meta:{$exists:true}}).forEach(function(doc){ | |
if(doc && doc.meta && doc.meta.stores){ | |
for(var i = 0; i < doc.meta.stores.length; i++){ | |
if(!stores[doc.meta.stores[i]]) | |
stores[doc.meta.stores[i]] = 1; | |
else | |
stores[doc.meta.stores[i]]++; | |
} | |
} | |
}); | |
for(var i in stores){ | |
print(i+" "+stores[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment