Database showing despite dropping

I have dropped couple of databases from my mongo replica set using “db.dropDatabase()” command however on executing “show dbs” I still see all of them. I have rebooted my mongo servers and refreshed everything but the result is same.

Any suggestions or if this is some normal behavior?

Welcome to the MongoDB Community Forums @Rajeev_Vishal !

Restarting members of a replica set should be unnecessary to ensure a database has been completely dropped.

Please provide some more details to help investigate the issue:

  • Is this is a standalone replica set, or part of a sharded cluster?

  • Did you run db.dropDatabase() on the primary while it was part of the replica set?

  • What is your version of mongo shell as reported by version()?

  • What is your version of MongoDB server as reported by db.version()?

  • What filesize in GB is displayed in the output of show dbs for the databases you have dropped?

  • Have you queried to contents of these DBs to see what collections and documents are present?

This could be normal behaviour if you have processes which continue to insert data after a database has been dropped: a database will automatically be created if new data is being inserted.

There are other possibilities depending on your answers to the questions I’ve asked above.


Hi Stennie,

Thanks for responding. My answers are below:

  • This is standalone replica set
  • Yes I executed on primary (I think we cannot execute this on secondary as I tried that too but got an error)
  • 4.2.16
  • 4.2.16
  • All except one show 0.000GB. The odd one out has 0.094GB
  • All DBs showing no size had 1 common collection df.FunctionHistory with data inside it. As for the other odd one it had many collections(37). I queried few of its collections randomly (around 10) but they did not return any result, ie empty.

I don’t think any data is being inserted in any of those as they are not accessed via our application.

Let me know.


Hello, any update on this please.

That’s a well known bug that has been fixed in mongodb v5.0. Maybe it will be back ported. See

I spoke too fast. The mentioned bug is only for sharded clusters but you encountered on a replSet. I couldn’t edit nor delete my previous post since it’s too old already. Sorry.

Hello, just found that a function was writing data into the client hence it was being created. Was able to remove the DBs now.

Thanks for the responses.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.