You can calculate the size of various documents using the BSON spec.
For example, a document {a:1}
consisting of one key with an integer value would take 5+1+2+4=12 bytes.
You can use various drivers to convert your data to BSON to see how much space it actually takes up:
serene% irb -rbson
irb(main):001:0> {a:1}.to_bson.to_s
=> "fx00x00x00x10ax00x01x00x00x00x00"
irb(main):002:0> {a:1}.to_bson.to_s.length
=> 12
If you have, let's say, documents which are flat (non-nested) mappings with keys that are 10 bytes long and 64-bit integer values, each key-value pair takes up 1+10+1+8=20 bytes. You can have about 800,000 such key-value pairs in a single document.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…