Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 42
    @connorbode Thanks for this. I've read it and immediately though: "B-But OP doesn't wants to remove the database!". Very misleading command !! Commented Nov 25, 2015 at 13:56
  • 1
    Use with caution: if you're in a sharded environment using wiredTiger and you have no user database and you invoke dropDatabase, the database will be deleted and could re-appear as primary on a different shard when new records are added. Commented Aug 4, 2016 at 14:50
  • 7
    This won't delete the user that is attached to related database. So you may want to delete it manually. db.dropAllUsers(); Commented Nov 11, 2016 at 9:13
  • 5
    Note that the database will not show after using the "use dbs" command. However, it is there. So, no worries. Commented Apr 3, 2017 at 17:45
  • 3
    @StepanYakovenko Probably need to authenticate with the MongoDB instance Commented Jul 25, 2019 at 16:36