My Mongo version is 2.6.9
I have an application that is inserting, reading and removing data from Mongo. That's all working fine. However the disk space increases exponentially. My HDD is around 120 GB, and Mongo consumes about 100GB.
I checked the collection to see what was consuming so much data. I couldn't do a "repair database" because of disk space. So I removed my database completely:
mongodump -d db
echo 'db.dropDatabase()' | mongo db
mongorestore /root/bashscript/backups/dump/db
I re-imported all the old documents, except from the collection that was consuming so much data. I recreated this collection with compact and power of 2 sizes (because that should do the trick).
Now when I add new data into this collection (around 200.00 docs), the result is the same, the collection is using 80GB of data.
What am I doing wrong? Am I using Mongo DB incorrectly? Is it not a good idea to use Mongo DB in my situation? I don't understand why Mongo is consuming so much disk space.
Here is the output of db.stats();
db.stats()
{
"db" : "secret",
"collections" : 13,
"objects" : 1270459,
"avgObjSize" : 1626.300957370525,
"dataSize" : 2066148688,
"storageSize" : 2616651776,
"numExtents" : 97,
"indexes" : 39,
"indexSize" : 496086976,
"fileSize" : 4226809856,
"nsSizeMB" : 16,
"dataFileVersion" : {
"major" : 4,
"minor" : 5
},
"extentFreeList" : {
"num" : 0,
"totalSize" : 0
},
"ok" : 1
}
Update responding to answers so far: I can't update to Mongo 3.0, because the database is used in production. But I guess the solution is upgrade to Mongo 3.0 and this should resolve the problem?