title: How to design product category and products models in mongodb?
body: <p>I am new to mongo db database design,
  I am currently designing a restaurant products system, and my design is similar to a simple eCommerce database design where each productcategory has products so in a relational database system this will be a one (productcategory) to many products.
  I have done some research I  do understand that in document databses.
  Denationalization is acceptable and it results in faster database reads.
  therefore in a nosql document based database I could design my models this way</p>
  
  <pre><code>    //product
       {
          name:'xxxx',
          price:xxxxx,
          productcategory:
          {
            productcategoryName:'xxxxx'
  
          }
       }
  </code></pre>
  
  <p>my question is this, instead of embedding the category inside of each product, why dont we embed the products inside productcategory, then we can have all the products once we query the category, resulting in this model.</p>
  
  <pre><code>    //ProductCategory
      {
         name:'categoryName',
         //array or products
         products:[
                   {
                    name:'xxxx',
                    price:xxxxx
                    },
                     {
                    name:'xxxx',
                    price:xxxxx
                    }
                  ]
      }
  </code></pre>
  
  <p>I have researched on this issue on this page <a href="http://www.slideshare.net/VishwasBhagath/product-catalog-using-mongodb" rel="noreferrer">http://www.slideshare.net/VishwasBhagath/product-catalog-using-mongodb</a> and here http://www.stackoverflow.com/questions/20090643/product-category-management-in-mongodb-and-mysql both  examples I have found use the first model I described (i.e they embed the productCategory inside product rather than embed array of products inside productCategory), I do not understand why, please explain. thanks </p>