1

I'm doing a simple forum mongodb DB, with categories,topics,posts and users.

My question is :

How should i do the references between categories,topics and posts to be as faster and lighter as posible, with the _id or nesting objects like this?

categories{category:'categoryname',
           topics:{topic:'topic',
                   posts:{post:'post',
                          user:'_idfromusers'
                         }
                   }               
          }

Suppose category has a very very big number of topics, and topics has a very very big number of posts.

marioshki
  • 23
  • 1
  • 7
  • 3
    See more about data model for Mongodb on page http://docs.mongodb.org/manual/core/data-model-design/ I use it to choose an approach for storing data in database – jmen7070 May 08 '14 at 10:57
  • Also, please give a certain focus in your question on how will MongoDB behave based on it's limits (collections and documents). Nesting the data seems feasible from a theoretical point of view (as explained in @jmen7070 's link), but you could hit a wall as soon as you pass certain size limits. – alexandernst May 08 '14 at 11:01
  • Then, if i do a Embedded model with a big number of nested objects with nested objects inside, it can crash if it exceed the mongodb colection's or document's size limit? – marioshki May 08 '14 at 11:10
  • @shkliciouz Yes, indeed. You must figure out how big your data will be and if Mongo will be able to handle it. – alexandernst May 08 '14 at 12:25

0 Answers0