title: MongoDb shell scripting
body: <p>Do you know if it is possible to get a list of databases(like 'show dbs' in console) from javascript. I want to drop all databases from mongo via javascript file (mongo admin.js), but i can't find a way to list all databases...</p>
  
  <p>Thx</p>
  
  <p>I'm trying to prepare simple script but i can't find out how i can change db from script.
  Here is the sample javascript script. It always fails on command "use". I tried with db.eval and eval but it fails.</p>
  
  <pre><code>print(db.getMongo().getDBNames());
  var environments = db.getMongo().getDBNames()
  for(var environmentIndex in environments){
      print(environments[environmentIndex])   
      eval("use staging");
      //db.dropDatabase();
  } 
  </code></pre>