mongodb: drop all collections How to remove existing content before entering a replicaset the first time?

mongodb worries about:


  ... has data already, cannot initiate set.  All members except initiator must be empty.
db.dropDatabase() will drop the database, which will also drop all of the collections within a database.

If you need to see what databases you have, you can do show dbs.

Update: Here's a script to delete everything, make sure you really want to do this:

var dbs = db.getSisterDB('admin').adminCommand("listDatabases").databases
for(d in dbs) db.getSisterDB(dbs[d].name).dropDatabase();