1

I've heard something recently that disturbs me and I can't seem to find any docs around it.

When deleting documents from mongodb, it doesn't clear the disk space

So I create a million documents, delete them and repeat this many times- I will run out of disk space.

Is this true? Is there anywhere I can read about this? I heard it's true for other dbs As well.

Thank you in advance.

Community
  • 1
  • 1
WebQube
  • 8,510
  • 12
  • 51
  • 93
  • I don't think it is. my question was `and repeat this many times` and not for one time memry reallocation – WebQube Jul 03 '14 at 06:27
  • Per the duplicate question that was flagged, MongoDB does not free previously allocated storage space .. however space from deleted documents does go on a free list and can be re-used for new documents that are inserted or relocated. This is similar to how other databases work; if you want to reclaim excessive disk space in MongoDB you can rebuild the data files using the [repair](http://docs.mongodb.org/manual/reference/command/repairDatabase/#dbcmd.repairDatabase) command. See also: [MongoDB Storage FAQ](http://docs.mongodb.org/manual/faq/storage/). – Stennie Jul 05 '14 at 22:00

0 Answers0