I have a collection of documents in which I store an array of numbers. This collection is replenished with new documents about every 10 seconds. Every day I run a script which handles this arrays and leaves in documents only one number. After 3 month of data collecting I want to release disk space. Here is stat info of the collection from Robomongo:
{
"ns" : "orderbook",
"count" : 5363208,
"size" : 844457120,
"avgObjSize" : 157,
"storageSize" : 2795139072.0,
"capped" : false,
"wiredTiger" : {
"metadata" : {
"formatVersion" : 1
}
}
"nindexes" : 2,
"totalIndexSize" : 144482304,
"indexSizes" : {
"_id_" : 90615808,
"date_1" : 53866496
}
}
As you can see the storageSize is much larger than the size. I expect that command compact
will release disc space.
What I do in mongo shell:
use trading
db.runCommand({compact:'orderbook', force: true})
The answer is
{ "ok" : 1 }
Logs from /var/log/mongodb/mongod.log:
2016-12-26T11:19:55.468+0300 I COMMAND [conn7] compact trading.orderbook begin, options: paddingMode: NONE validateDocuments: 1
2016-12-26T11:19:55.562+0300 I COMMAND [conn7] compact trading.orderbook end
Nothing happens. storageSize has the same value.
Any ideas? What am I doing wrong?