Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB Single Document size limit is 16MB

Tags:

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?

like image 594
Amol M Kulkarni Avatar asked Mar 09 '13 06:03

Amol M Kulkarni


People also ask

What is the maximum size of a single MongoDB document?

The maximum size an individual document can be in MongoDB is 16MB with a nested depth of 100 levels. Edit: There is no max size for an individual MongoDB database.

What is the maximum size of a MongoDB document 16 MB 12 MB 2 MB There is no maximum size it depends on the RAM?

Explanation. The maximum BSON document size is 16 megabytes. The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth.

What is the maximum size of a MongoDB document 1/32 2 16 3 There is no maximum size it depends on RAM?

MongoDB Single Document size limit is 16MB.


1 Answers

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.

like image 82
theon Avatar answered Sep 18 '22 15:09

theon