- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to reduce MongoDB storage space after deleting large amount of data?
To reduce MongoDB storage space after deleting a large amount of data, you need to use repairDatabase(). Let’s say we are using the database “test”. Following is the query to get to the current database
> db;
This will produce the following output
Test
After deleting large amount of data, this is how you can reduce the storage space of MongoDB
> db.repairDatabase()
This will produce the following output
{ "ok" : 1 }
Here is the screenshot after we implement the above query. This will reduce the storage space:
Advertisements