Cloning MongoDB (db.copyDatabase), clone only half of the database

I have a database that has about 4 GB of data, and when I try to reset it using mongodump, then it only dumps something around 1.93 GB. And when I try to clone its db.copyDatabase() , then it copies the same amount of data as mongodump.

Is there any limit in MongoDb?

Thanks for the help and sorry for my poor English (I hope you understand me).

EDIT

 { "ns" : "some-db.persons", "firstExtent" : "0:31000 ns:some-db.persons", "lastExtent" : "4:b50d000 ns:some-db.persons", "extentCount" : 13, "extents" : [ { "loc" : "0:31000", "xnext" : "0:42000", "xprev" : "null", "nsdiag" : "some-db.persons", "size" : 32768, "firstRecord" : "0:310b0", "lastRecord" : "0:38e3c" }, { "loc" : "0:42000", "xnext" : "0:62000", "xprev" : "0:31000", "nsdiag" : "some-db.persons", "size" : 131072, "firstRecord" : "0:420b0", "lastRecord" : "0:61e64" }, { "loc" : "0:62000", "xnext" : "0:e2000", "xprev" : "0:42000", "nsdiag" : "some-db.persons", "size" : 524288, "firstRecord" : "0:620b0", "lastRecord" : "0:e0f0c" }, { "loc" : "0:e2000", "xnext" : "0:372000", "xprev" : "0:62000", "nsdiag" : "some-db.persons", "size" : 2097152, "firstRecord" : "0:e20b0", "lastRecord" : "0:2e1d94" }, { "loc" : "0:372000", "xnext" : "0:dd6000", "xprev" : "0:e2000", "nsdiag" : "some-db.persons", "size" : 8388608, "firstRecord" : "0:3720b0", "lastRecord" : "0:b71e80" }, { "loc" : "0:dd6000", "xnext" : "0:2233000", "xprev" : "0:372000", "nsdiag" : "some-db.persons", "size" : 11325440, "firstRecord" : "0:dd60b0", "lastRecord" : "0:18a2db8" }, { "loc" : "0:2233000", "xnext" : "1:2000", "xprev" : "0:dd6000", "nsdiag" : "some-db.persons", "size" : 15290368, "firstRecord" : "0:22330b0", "lastRecord" : "0:30c7e20" }, { "loc" : "1:2000", "xnext" : "1:223d000", "xprev" : "0:2233000", "nsdiag" : "some-db.persons", "size" : 20643840, "firstRecord" : "1:20b0", "lastRecord" : "1:13b1e9c" }, { "loc" : "1:223d000", "xnext" : "2:2000", "xprev" : "1:2000", "nsdiag" : "some-db.persons", "size" : 27869184, "firstRecord" : "1:223d0b0", "lastRecord" : "1:3cd0e7c" }, { "loc" : "2:2000", "xnext" : "2:73ba000", "xprev" : "1:223d000", "nsdiag" : "some-db.persons", "size" : 37625856, "firstRecord" : "2:20b0", "lastRecord" : "2:23e3dd8" }, { "loc" : "2:73ba000", "xnext" : "3:4bd7000", "xprev" : "2:2000", "nsdiag" : "some-db.persons", "size" : 50798592, "firstRecord" : "2:73ba0b0", "lastRecord" : "2:a42be78" }, { "loc" : "3:4bd7000", "xnext" : "4:b50d000", "xprev" : "2:73ba000", "nsdiag" : "some-db.persons", "size" : 68579328, "firstRecord" : "3:4bd70b0", "lastRecord" : "3:8d3dda4" }, { "loc" : "4:b50d000", "xnext" : "null", "xprev" : "3:4bd7000", "nsdiag" : "some-db.persons", "size" : 92581888, "firstRecord" : "4:b50d0b0", "lastRecord" : "4:ba17118" } ], "datasize" : 244286608, "nrecords" : 268872, "lastExtentSize" : 92581888, "padding" : 1, "firstExtentDetails" : { "loc" : "0:31000", "xnext" : "0:42000", "xprev" : "null", "nsdiag" : "some-db.persons", "size" : 32768, "firstRecord" : "0:310b0", "lastRecord" : "0:38e3c" }, "lastExtentDetails" : { "loc" : "4:b50d000", "xnext" : "null", "xprev" : "3:4bd7000", "nsdiag" : "some-db.persons", "size" : 92581888, "firstRecord" : "4:b50d0b0", "lastRecord" : "4:ba17118" }, "objectsFound" : 218678, "invalidObjects" : 0, "bytesWithHeaders" : 207046812, "bytesWithoutHeaders" : 203547964, "deletedCount" : 6, "deletedSize" : 87297536, "nIndexes" : 1, "keysPerIndex" : { "some-db.persons.$_id_" : 268872 }, "valid" : true, "errors" : [ ], "ok" : 1 } 
+4
source share
1 answer

The data is probably all there; MongoDB allocates extra space over time that will not be included in the copy. Check the number of documents in the collections to check.

0
source

Source: https://habr.com/ru/post/1479136/


All Articles