Skip to content

Instantly share code, notes, and snippets.

@ibirman
Created September 15, 2016 18:14
Show Gist options
  • Select an option

  • Save ibirman/34ea664cc2054865d89594c0ffdb65ab to your computer and use it in GitHub Desktop.

Select an option

Save ibirman/34ea664cc2054865d89594c0ffdb65ab to your computer and use it in GitHub Desktop.
Mongo Get Something from Each Database
var ld = db.adminCommand( { listDatabases: 1 } );
ld.databases.forEach(function(dbName){
var dbx = db.getSiblingDB(dbName.name);
var AccountIds = dbx['Network.Environment'].find().map(function(view){
if (view.AuditedAccountIds == null || view.AuditedAccountIds == 'undefined'){
print(dbName.name + ", " + view.AuditedAccountIds);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment