Do you know if you can get a list of databases (for example, "show dbs" in the console) from javascript. I want to delete all databases from mongo through a javascript file (mongo admin.js), but I cannot find a way to list all the databases ...
thanks
I am trying to prepare a simple script, but I cannot find out how I can change the db from the script. Here is an example javascript script. It always fails in the "use" command. I tried with db.eval and eval, but it fails.
print(db.getMongo().getDBNames()); var environments = db.getMongo().getDBNames() for(var environmentIndex in environments){ print(environments[environmentIndex]) eval("use staging"); //db.dropDatabase(); }
javascript mongodb nosql
user253202
source share