我如何使用ruby驱动程序知道MongoDB中文档的大小 [英] How I know my document's size inside MongoDB with the ruby driver

查看:77
本文介绍了我如何使用ruby驱动程序知道MongoDB中文档的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MongoDB中一个文档的限制是4Mo.我有一些文档,其中包含大量数据.

The limitation of one document in MongoDB is 4Mo. I have some documents really heavy with a lot of data.

我如何使用ruby驱动程序知道MongoDB中文档的大小?

How I know my document's size inside MongoDB with the ruby driver ?

推荐答案

您可以使用BSON.serialize并找到生成的字节缓冲区的长度.参见 http://www.mongodb.org/display/DOCS/BSON#BSON -Ruby 有关使用BSON.serialize的示例.

You can use BSON.serialize and find the length of the resulting byte buffer. See http://www.mongodb.org/display/DOCS/BSON#BSON-Ruby for an example of using BSON.serialize.

这篇关于我如何使用ruby驱动程序知道MongoDB中文档的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆