I would like to know if there\'re a command to drop every databases from my MongoDB?
I know if I want to drop only one datatable, I just need to type the name of the dat
var mongo = db.getMongo(); mongo.getDBNames().filter(n => n != 'admin' && n != 'local' && n != 'config').forEach(function (dbname) { var db = mongo.getDB(dbname); db.dropDatabase(); });
This one is safe to copy and execute on mongoshell. Credits to all answers above. Just exclude 'config' database as well.