开发者

mongodb capsized collection - individual record size?

How big are individual records in MongoDB?

I have a capped size collection of 250MBs and for some reason can barely fit 260 documents in it. 开发者_StackOverflow中文版My documents contain normal logging data, that I wouldn't estimate to be over 150Kb... I'd go as far as 300KB per document but that's really going far with it.

Can anyone enlighten me as to the inner workings of mongo?

UPDATE: I've checked some decently populated documents with Object.bsonsize and they show "60" (Im assuming KBs). Why then would mongo make every document to be 1mb in size?

Upadte 2: I've now confirmed the problem is with a gem i'm using "central_db_logger" for ruby. It seems to be pushing docs with somekind of a buffer. I'm not sure how or why. But adding myself document i've added thousands while central_Db_logger seems to add document that are very large that overwrite my test documents.


Did you set a max or size when you created the collection?

This will create a byte-limited capped collection:

db.createCollection("mycoll", {capped:true, size:100000});

This will create a document-count AND byte-limited capped collection:

db.createCollection("mycoll", {capped:true, size:100000, max:100});

If you set your max to 250, you surely wont get 260 documents in it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜