Force drop a collection in MongoDB
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?
![igorgue](https://i.stack.imgur.com/kZ9kN.jpg?s=256&g=1)
igorgue
I'm a programmer that likes Python, Haskell, Ruby, Erlang, Elixir, C#.
Updated on June 24, 2022Comments
-
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 oftmp.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 getfalse
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 over 13 yearsRepair, 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.