Compact Command in MongoDB | Managing Disk Space in MongoDB | compact in MongoDB Replica | How do I compact a collection in MongoDB? |
Why disk space does not frees up after deleting in MongoDB
Hello and namaste everyone,
When documents or collections are deleted, empty record blocks within data files arise. MongoDB attempts to reuse this space when possible, but it will never return this space to the file system. This behavior explains why fileSize never decreases despite deletes on a database.
So, compact command rewrites and defragments all data and indexes in a collection. On WiredTiger databases, this command will release unneeded disk space to the operating system.
#mongodbCompact #mongoDbManageSpace #mongoDbFreeUpDisk #smartyTechFizzMongoDb