MongoDB Single Document size limit is 16MB

2019-01-14 20:57发布

问题:

Known Information: Its is know that MongoDB stores in BSON (Binary JSON) and the maximum BSON document size is 16MB.

Question: Why 16MB itself why not 32MB or 64MB or still more and where exactly the limit has been put for 16MB and what are the reasons to depend on exactly 16MB?

It is mentioned that during transmission, excessive amount of bandwidth will not be consumed and does not require excessive amount of RAM at server. But What if we can afford the network bandwidth and RAM memory consumption. Then also, we are left with no option other than GridFS. Why?

It may sound stupid. But please could anyone put some bright light on this?


Update: It was 4MB and now 16MB.

mongodb BSON size

We can check it on Mongo Shell by issuing following command

db.isMaster().maxBsonObjectSize/(1024*1024)

Why it is not allowed as configurable by DBAs?

回答1:

Check out the thread on the JIRA ticket that increased the value from 4MB to 16MB. There is a sizeable debate on the ticket: https://jira.mongodb.org/browse/SERVER-431

It seems to be arbitrary why they chose 16MB, and not say 32MB. It was increased because many people needed to store documents larger than 4MB (and I presume lower than 16MB). Some people have asked in that thread to have it made configurable (like you asked), which makes sense to me. Not sure why they haven't decided to do this.