title: The way mongodb optimized for aggregation and querying
body: <p>I'm using MongoDB in my project for statistical and data analysis things. My goal is design data to have best performance and scaleability.</p>
  
  <p>Let's assume I have several shops and a list of unique products per shop. And I need to query some data about the products, calculate some basic statistic (only by curtain shop).</p>
  
  <p>Which way is better from the performance point of view: to have a Shop document and a list of products inside and then make querying only per this document.</p>
  
  <p>Or better will be having separate collection with all products per all shops in it and then build queries for that collection?</p>
  
  <hr>
  
  <p>Maybe the question itself: does mongodb could query through the body of one document with such efficient manner like through many documents.</p>
  
  <hr>
  
  <p><strong>UPD 1:</strong>
  For now let's assuming that products itself is quite small (Id, Price, Name, Count) and the amount of it is limited. (So I know for sure that it won't be more than 1000 products per shop)</p>
  
  <p><strong>UPD2</strong>
  Also lets assuming that I don't want to read that database for the view purposes, just for statistics. (How much sold, which is most interesting, what groups and so on)</p>