title: MongoDB CRM Database Design Efficiency
body: <p>In my CRM I plan to be able to support a scale of 100 businesses for now, but ideally this would scale to any size.</p>
  
  <p>The way it's set up right now:</p>
  
  <p>Each business has 3 sections of data
  Each section has 1000 "entries"
  Each entry has 30 - 50 "data chunks" - Each data chunk has an id, an entry that it corresponds to, a value to indicate which type of data it is, and the value it's holding.</p>
  
  <p>100 * 3 * 1000 * 30 = 9000000 pieces of data.</p>
  
  <p>I'll normally only be pulling 100 entries at any given time so only 3000-5000 or so data chunks being pulled, but once in a while it could be as many as 1000 entries or more at once.</p>
  
  <p>I have collections for businesses, sections, entries, and data chunks.</p>
  
  <p>I'm setting it up this way because some business will be keeping different kinds of data than others and an SQL database doesn't really work with that.</p>
  
  <p>A sample generation of data might look like this:</p>
  
  <ul>
  <li>find one section by name (ie business1 has a section called section1)</li>
  <li>find 100 entries for that section</li>
  <li>find 30 data pieces for each of those entries</li>
  </ul>
  
  <p>That'd result in 101 find calls. I could also do the find call for the entries and then a find call for the data with a where array that has 100 or key/value pairs, which would pull 100 data entries where their entry id was one of those 100 or key/value pairs.</p>
  
  <p>Is this a scalable database design? Is there a better way I should be doing it?</p>