1. First I have checked MongoDB Size 36GB
2. I have removed few tables data
3. Again I have checked MongoDB Size (36GB) not reduced. After I have searched google and solution.
I have tried few below methods and take more time, slow my application (hang)
Method 1: db.repairDatabase
Method 2:
db.getMongo().getDBNames().forEach(function(dbName) {
if ("local" != dbName && "admin" != dbName && "system" != dbName) {
var subject = db.getSiblingDB(dbName);
subject.getCollectionNames().forEach(function (collectionName) {
print('Compacting: ' +dbName + " - " + collectionName);
subject.runCommand({ compact: collectionName });
});
}
});
So, I need better solution. If any one know about this kindly let me know.