Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (47.6k points)

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

 

2 Answers

0 votes
by (106k points)
To drop a MongoDB database from the command line you can use following command:-

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

0 votes
by (107k points)

You can perform it from the mongodb console:

> use mydb; 

> db.dropDatabase();

Or, you can stop mongod and delete the data files from your data directory, then restart.

Related questions

0 votes
2 answers
asked Sep 4, 2019 in SQL by Sammy (47.6k points)
0 votes
0 answers
0 votes
1 answer
0 votes
3 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...