Skip to content

Instantly share code, notes, and snippets.

@marcoberri
Created September 9, 2015 08:33
Show Gist options
  • Select an option

  • Save marcoberri/dc03eba1952cb8a48b77 to your computer and use it in GitHub Desktop.

Select an option

Save marcoberri/dc03eba1952cb8a48b77 to your computer and use it in GitHub Desktop.
MongoDB - Enable all profile for all db (excluded local and admin)
var dbs_list = db.getMongo().getDBNames();
for(var d in dbs_list){
var name = dbs_list[d];
if(name == 'admin')
continue;
if(name == 'local')
continue;
dbOne = db.getSisterDB(name);
dbOne.setProfilingLevel(0);
dbOne.system.profile.drop();
dbOne.createCollection("system.profile", {capped:true, size:8000000});
dbOne.setProfilingLevel(2);
print(name + " --> complete");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment