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
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises