Skip to content

Instantly share code, notes, and snippets.

@ar2rsawseen
Created September 14, 2015 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ar2rsawseen/5d1dec271d4506cace81 to your computer and use it in GitHub Desktop.
Save ar2rsawseen/5d1dec271d4506cace81 to your computer and use it in GitHub Desktop.
Get sources from Countly DB
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