Skip to content

Instantly share code, notes, and snippets.

@ar2rsawseen
Created September 14, 2015 07:28
Show Gist options
  • Select an option

  • Save ar2rsawseen/5d1dec271d4506cace81 to your computer and use it in GitHub Desktop.

Select an option

Save ar2rsawseen/5d1dec271d4506cace81 to your computer and use it in GitHub Desktop.

Revisions

  1. ar2rsawseen created this gist Sep 14, 2015.
    16 changes: 16 additions & 0 deletions getSources.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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]);
    }