MongoDB: embedding performance question

By : Alex

I just started learning MongoDB, and I really like the idea of embedding collections instead of referencing them.

MongoDB's documentation recommends to use embedding if performance is needed.

I just thought about a simple forum model. Let's say, every board category has several boards, every board has several topics, and every topic has several messages. All of these collections are embedded.

After some time the size of the board category will be huge. Way more than the 2MB limit. Does this mean that there's a flaw in this design?

By : Alex


Yes it's a bad design. Using a Embedded document to something grow every time is a bad design. The limit of document is do by mongoDB mainteneur to avoid this document increase.

By : shingara

This video can help you solving your question :)
By: admin