问下mongo存储 字符串长度限制是多少?

需要记录系统日志时,把参数存入字符串字段中,该字段字符串为2025,

[{"attrValue":[{"barCode":"1","cost":1,"image":"http://images.zouyun.life/images/2021/05/18/1621305356517376.jpg","otPrice":1,"price":1,"serviceCharge":1,"stock":1,"suk":"红|x","volume":1,"weight":1,"zouYunDeductionPercentage":1,"zouYunValueRatio":1},{"barCode":"1","cost":1,"image":"http://images.zouyun.life/images/2021/05/18/1621305356517376.jpg","otPrice":1,"price":1,"serviceCharge":1,"stock":1,"suk":"红|xl","volume":1,"weight":1,"zouYunDeductionPercentage":1,"zouYunValueRatio":1},{"barCode":"1","cost":1,"image":"http://images.zouyun.life/images/2021/05/18/1621305356517376.jpg","otPrice":1,"price":1,"serviceCharge":1,"stock":1,"suk":"蓝|x","volume":1,"weight":1,"zouYunDeductionPercentage":1,"zouYunValueRatio":1},{"barCode":"1","cost":1,"image":"http://images.zouyun.life/images/2021/05/18/1621305356517376.jpg","otPrice":1,"price":1,"serviceCharge":1,"stock":1,"suk":"蓝|xl","volume":1,"weight":1,"zouYunDeductionPercentage":1,"zouYunValueRatio":1},{"barCode":"1","cost":1,"image":"http://images.zouyun.life/images/2021/05/18/1621305356517376.jpg","otPrice":1,"price":1,"serviceCharge":1,"stock":1,"suk":"绿|x","volume":1,"weight":1,"zouYunDeductionPercentage":1,"zouYunValueRatio":1},{"barCode":"1","cost":1,"image":"http://images.zouyun.life/images/2021/05/18/1621305356517376.jpg","otPrice":1,"price":1,"serviceCharge":1,"stock":1,"suk":"绿|xl","volume":1,"weight":1,"zouYunDeductionPercentage":1,"zouYunValueRatio":1}],"brandId":"6099db85f3fa3d1f2a4b67ac","categoryIds":["609b67914583c95a53fcbcca"],"coding":"啦啦啦1","content":"<p>道歉我ID那我去噢ID你群殴那我我弄请问您的哦亲你我那去挖你都去我弄你&nbsp;</p>","groupId":"60a201212b51a115eeb22b7e","mainPicture":"http://images.zouyun.life/images/2021/05/18/16213053294953508.jpg","name":"啦啦啦","slidePicture":"[\"http://images.zouyun.life/images/2021/05/18/16213053352778282.jpg\"]","status":0,"stockShow":1,"stockWarning":100,"supplierId":"6098f864f8445b61600ad6e5","tagsIds":["6098f05ef8445b61600ad6d7"],"video":"http://images.zouyun.life/video/2021/05/18/16213053433696791.mp4","virtualSales":100}]

直接把这段转成字符串后存入报错Timeout while receiving message; nested exception is com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message,这是不能存储json这种格式的原因么还是啥?超出限制了?有大神帮我解答下么

阅读 3.3k
1 个回答

小兄弟,你这个异常是读取超时,跟字符串长度没啥关系,应该考虑网络原因

This exception is thrown when there is a timeout reading a response from the socket.

而mongodb中单个文档最大可以达到16MB,远远大于你的字符串长度

The maximum BSON document size is 16MB or 16777216 bytes.
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题