Force drop a collection in MongoDB

10,345

Now I maxed up my namespaces and I cannot create more collections help?

By default MongoDB has 20k namespaces, so that's a lot of dead M/R collections. According to the logs, the DB is getting the request to drop the collection. So the question now is whether or not MongoDB has gotten into a bad state.

Can you take it down and re-start to ensure that all connections are closed?

Is it a lot of data? Can you take it down and run --repair?

Share:
10,345
igorgue
Author by

igorgue

I'm a programmer that likes Python, Haskell, Ruby, Erlang, Elixir, C#.

Updated on June 24, 2022

Comments

  • igorgue
    igorgue about 2 years

    I can't delete a collection it's telling me false every single time..

    I do a getCollections() it gives me a lot of tmp.mr.mapreduce_1299189206_1618_inc (the ones I want to drop) I thought they were deleted during disconnection, but they're not (in my case).

    Then when I do: db["tmp.mr.mapreduce_1299188705_5595"].drop() I always get false and it's not deleted.

    The logs are not really helpful:

    Wed Mar  9 11:05:51 [conn4] CMD: drop customers.tmp.mr.mapreduce_1299188705_5595
    

    Now I maxed up my namespaces and I cannot create more collections help?

    BTW, I can go down, this is not production (or even in production I can put it down too).

  • igorgue
    igorgue over 13 years
    Repair, fixed some of the indexes I couldn't delete, that saved me some space, the problem was that there was still some dead m/r collections, I just decided to delete the db and remigrate.