db.dropDatabase() in mongodb

dropDatabase(writeConcern?)

This method removes the current database, deleting the associated data files.

WARNING

This command obtains a global write lock and will block other operations until it has been completed.


The following example in the mongo shell uses the use <database> operation to switch the current database to the products database and then uses the db.dropDatabase() method to drop the products database.


use products

db.dropDatabase()


Approach

MongoDB

db.dropDatabase()

Output:

{ "ok" : 1 }


No comments:

Post a Comment