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 database like the code below but I dont want to have to specify it.
mongo DB_NAME --eval 'db.dropDatabase();'
you can create a javascript loop that do the job and then execute it in the mongoconsole.
save it to dropall.js and then execute: