Why does MongoDB Keep Holding on to disk space?
MongoDB will keep holding on to the entire 10 GB disk space it had before, so it can use that same space to accommodate new data. You can easily see this yourself by running a db.stats(): The dataSize parameter shows the size of the data in the database, while storageSize shows the size of data plus unused/freed space.
What does the datasize parameter on MongoDB mean?
The dataSize parameter shows the size of the data in the database, while storageSize shows the size of data plus unused/freed space. The fileSize parameter, which is essentially the space your database is taking up on disk, includes the size of data, indexes, and unused/freed space.
What happens if I delete 10 GB of data from MongoDB?
Here’s a simple example: Let’s say you have 10 GB of data in a MongoDB database, and you delete 3 GB of that data. However, even though that data is deleted and your database is holding only 7 GB worth of data, that unused 3 GB will not be released to the OS.
What does the repair command do in MongoDB?
MongoDB repair operation repairs all errors and inconsistencies in data storage, similar to the fcsk command for a file system. This command ensures the data integrity after an unexpected shutdown or crash.
What does the filesize parameter mean in MongoDB?
The fileSize parameter, which is essentially the space your database is taking up on disk, includes the size of data, indexes, and unused/freed space. MongoDB is commonly used to store large quantities of data, often in read-heavy situations where the amount of data manipulation operations are relatively much less.
How do you compact data in MongoDB database?
Depending on your setup and the storage engine you’re using for your MongoDB, you have a couple of choices. The compact command works at the collection level, so each collection in your database will have to be compacted one by one. This completely rewrites the data and indexes to remove fragmentation.