db.dropDatabase()

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Database and collection discovery

What it does

Drops the current database.

Syntax

db.dropDatabase()

Use case

Reset a disposable test database.

Important notes

Destructive: verify database selection and privileges first.

db.dropDatabase(): practical example
db.dropDatabase()
💡 Explanation Drops the current database. When to use it Reset a disposable test database. Caution Destructive: verify database selection and privileges first.
Key Takeaways
  • Drops the current database.
  • Typical use: Reset a disposable test database.