-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Diagnostics, Shell, Tools
-
None
Hello, I am not able to find out the real size of document stored in mongo collections. I googled, that document size may be obtained by two methods:
Object.bsonsize - some javascript method that should return a size in bytes
db.collection.stats() - where there is a line 'avgObjSize' that produce some "aggregated"(average) size view on the data. It simply represents average size of single document.
I have a really simple document with this structure:
{
test: "test",
ids: [id1, id2, id3..... id500000]
}
each id is constructed by 10 characters.
By simle computation, the overall size should be more than 5 MB.
But when I initiate the 'Object.bsonsize' command, it returns: 499.
Stats command returns 'size' = 10747888.
I am really confused. Is there any way how to reliable find out size of the particular document? Are my steps performed so far absolutely wrong?
Thank you for your support, any help will be appreciated.