MongoDB: db.dropDatabase() method
db.dropDatabase
The db.dropDatabase() method is used to remove the current database along with the associated data files.
Syntax:
db.dropDatabase()
Example: MongoDB: db.dropDatabase() method
Here is the databases.
> show dbs
admin 0.078GB
local 0.078GB
myinfo 0.078GB
newtest 0.078GB
payroll 0.078GB
test 0.078GB
The following example will drop the database newtest.
db.dropDatabase();
Output:
> db.dropDatabase(); { "dropped" : "newtest", "ok" : 1 } Now list the databases : > show dbs admin 0.078GB local 0.078GB myinfo 0.078GB payroll 0.078GB test 0.078GB
Retrieve the restaurants data from here
Previous:
db.currentOp() method
Next:
db.fsyncLock() method
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework