title: How should I implement this schema in MongoDB?
body: <p>I'm trying to write a tracking script and I'm having trouble with figuring out how the database should work.</p>
  
  <p>In MySQL I'd create a table that looks similar to </p>
  
  <pre><code>User:
     username_name: string
  
  Campaign:
     title: string
     description: string
     link: string
  
  UserCampaign:
     user_id: integer
     camp_id: integer
  
  Click:
     os: text
     referer: text
     camp_id: integer
     user_id: integer
  </code></pre>
  
  <p>I need to be able to:</p>
  
  <ul>
  <li>See the information from each click like IP, Referer, OS, etc</li>
  <li>See how many often clicks are coming from X IP, X Referer, X OS</li>
  <li>Associate each click with a User and a Campaign</li>
  </ul>
  
  <p>If I do something along the lines of</p>
  
  <pre><code>User {
       Campaigns: [
           {
             Clicks: []
           }
       ]
  }
  </code></pre>
  
  <p>I run into two problems:</p>
  
  <ul>
  <li>It creates a new campaign object for each user which is a problem because if I need to update my campaign I'd need to update the object for each user</li>
  <li>I expect the Clicks array to contain a LARGE amount of data, I feel like having it a part of the User object will make it very slow to query </li>
  </ul>