Database Drop करना
dropDatabase current database और इसके अंदर हर collection remove करता है।
In this page:
Syntax
use database_name
db.dropDatabase()
Drop Database
db.dropDatabase() वह database delete करता है जो आप currently इस्तेमाल कर रहे हैं, सारी collections, indexes, और data समेत। यह tests और resets के लिए है। पहले db.getName() से double check करें, और एक verified backup के बिना इसे कभी production पर न चलाएँ।
Note:
यह confirm करने के लिए db.getName() चलाएँ कि आप कौन-से database पर हैं।
उदाहरण: Drop database
test> use scratch
switched to db scratch
scratch> db.getName()
scratch
scratch> db.dropDatabase()
{ ok: 1, dropped: 'scratch' }
⚠️ Run this in your own terminal or Node.js environment.
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- गलत database पर इसे चलाना
- कोई backup न होना
- habit से इसे production पर करना
चैप्टर सारांश
- dropDatabase current database में सब कुछ delete करता है
- पहले db.getName() check करें
- Backups के बिना irreversible
- Test resets के लिए ideal
🔒
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: