mongodb文档太大_MongoDB单文档大小限制为16MB

MongoDB的BSON文档最大尺寸为16MB,这个限制源于避免在网络传输和内存消耗中浪费资源。尽管一些用户可能能承受更大的带宽和内存消耗,但超过16MB的文档需要使用GridFS。MongoDB曾将限制从4MB提高到16MB,但并未提供可配置选项。讨论表明,是否应该让DBA自定义这个限制仍存在争议。
摘要由CSDN通过智能技术生成

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.

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?

解决方案

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.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值