How Do I Delete a Database in Mongodb
Select the Database You Want to Delete with the Help of Use Command. Following Is the Syntax of Use Command. Use Drop the Database with the Help of Db...
Select the database you want to delete with the help of USE <database> command. Following is the syntax of USE command. use <database_name>Drop the database with the help of db.dropDatabase() command. Following is the syntax of USE command. db.dropDatabase()
Which of the following will delete current database in MongoDB?
MongoDB db. dropDatabase() command is used to drop a existing database.
Must Read
How do I delete a collection in MongoDB?
Starting in MongoDB 5.0, the drop command and the db. collection. drop() method return an error if you try to drop a collection in the admin database or the config database from a mongos . To drop these collections, connect to the config server and run the command there.