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.
mongodb
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.
Best Answer
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: