Alex
Alex

Reputation: 36131

MongoDB: embedding performance question

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?

Upvotes: 1

Views: 399

Answers (1)

shingara
shingara

Reputation: 46914

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.

Upvotes: 1

Related Questions