title: Embed or reference in Mongodb
body: <p>I am developing a small app which will store information on users, accounts and transactions. The users will have many accounts (probably less than 10) and the accounts will have many transactions (perhaps 1000's). Reading the Docs it seems to suggest that embedding as follows is the way to go...</p>
  
  <pre><code>{
  "username": "joe",
  "accounts": [
      {
          "name": "account1",
          "transactions": [
              {
                  "date": "2013-08-06",
                  "desc": "transaction1",
                  "amount": "123.45"
              },
              {
                  "date": "2013-08-07",
                  "desc": "transaction2",
                  "amount": "123.45"
              },
              {
                  "date": "2013-08-08",
                  "desc": "transaction3",
                  "amount": "123.45"
              }
          ]
      },
      {
          "name": "account2",
          "transactions": [
              {
                  "date": "2013-08-06",
                  "desc": "transaction1",
                  "amount": "123.45"
              },
              {
                  "date": "2013-08-07",
                  "desc": "transaction2",
                  "amount": "123.45"
              },
              {
                  "date": "2013-08-08",
                  "desc": "transaction3",
                  "amount": "123.45"
              }
          ]
      }
   ]
  }
  </code></pre>
  
  <p>My question is... Since the list of transactions will grow to perhaps 1000's within the document will the data become fragmented and slow the performance. Would I be better to have a document to store the users and the accounts which will not grow as big and then a separate collection to store transactions which are referenced to the accounts. Or is there a better way? </p>