What’s the easiest way to do this from my bash prompt?

2Best Answer
21

Like this:

mongo <dbname> --eval "db.dropDatabase()"

More info on scripting the shell from the command line here: https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/#scripting

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *