V
V
Vitaly F.2010-09-09 17:28:06
MongoDB
Vitaly F., 2010-09-09 17:28:06

I read that MongoDB has a 4MB limit per document. Am I wrong?

It is especially not clear if it is recommended to de-normalize the data - for example, to store comments to the comment ...
comment:{Id:..., Text: ..., comments: []}
This will hit the limit and the pipe ...

Answer the question

In order to leave comments, you need to log in

7 answer(s)
X
xSkyFoXx, 2012-11-05
@FuN_ViT

In version 2.2, the size of a single document has been increased to 16M. Although, as many above said, GridFS will allow you to store files of any size. Even those that exceed the size of one physical computer in the cluster.

V
Vladimir Chernyshev, 2010-09-09
@VolCh

To bypass the restriction, there is GridFS, it seems :)

M
Masterkey, 2010-09-09
@Masterkey

mongo has another more interesting limitation www.mongodb.org/display/DOCS/Using+a+Large+Number+of+Collections
it worries me more than 4mb per write

T
TravisBickle, 2010-09-09
@TravisBickle

This is configurable.

M
miolini, 2010-09-09
@miolini

It seems to me that the problem is somewhat contrived, because a comment on a comment can be stored flat with a foreign key. For data larger than 4mb there is GridFS.

M
MagaSoft, 2010-09-09
@MagaSoft

This is how many comments to write for 4 mb. Even on 32-bit machines, the total database size is limited to 2 GB, once started.
GridFS is still for binaries, I don't think it's the best solution.
In extreme cases, you can specify in the application the maximum amount of comments stored in one document and, when it is reached, open a new one with DBRef (foreign key) to the main one.

V
vansickle, 2010-09-09
@vansickle

1) For text data - 4MB is a lot, all binary data will go to GridFS
2) In version 1.7 this can be configured
3) If you still go beyond 4MB, then it is solved by changing the database structure - for the example above, we make a collection of comments "flat" with links. See www.mongodb.org/display/DOCS/Trees+in+MongoDB vansickle, Today at 23:07 for more details on tree data options in Mongo

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question