开发者

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

开发者 https://www.devze.com 2022-12-24 17:43 出处:网络
The limitation of one document in MongoDB is 4Mo. I have some documents really heavy with a lot of data.

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

How 开发者_StackOverflowI know my document's size inside MongoDB with the ruby driver ?


Or native Object.bsonsize(db.Foo.findOne());


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消