title: Cross-links/updates between documents in NoSQL database
body: <p>For multiple reasons, I'm currently considering moving to a NoSQL DB to store/manage a set of "scorecards". As scorecard is a simple table, with rows for  regions and columns for metrics/indicators. As simple scorecard document for one month could look like this:</p>
  
  <pre><code>{
    "month": 1,
    "headers": ["Region", "# of page views", "# of unique visitors"],
    "data": [
       ["Region 1", {"value": 1000, "previousValue": 800, "arrow": "up" }, {"value": 100, "previousValue": 110, "arrow": "down"}],
       ["Region 2", {"value": 500, "previousValue": 600, "arrow": "down" }, {"value": 10, "previousValue": 11, "arrow": "down"}]
    ]
  }
  </code></pre>
  
  <p>resulting in this rendered table:</p>
  
  <pre><code>|  Region  | # of page views | # of unique visitors |
  |----------|-----------------|----------------------|
  | Region 1 | 1000 (↑)        | 100 (↓)              |
  | Region 2 | 500 (↓)         | 10 (↓)               |
  </code></pre>
  
  <p>Every month, a new scorecard will be uploaded, i.e. a new document gets created. This scorecard might have a different structure, e.g. </p>
  
  <pre><code>{
    "month": 2,
    "headers": ["Region", "# of page views", "# of comments"],
    "data": [
       ["Region 1", {"value": 1100, "previousValue": 1000, "arrow": "up"}, {"value": 5, "previousValue": null, "arrow": null}],
       ["Region 3", {"value": 1500, "previousValue": null, "arrow": null},{"value": 1, "previousValue": null, "arrow": null}]
    ]
  }
  </code></pre>
  
  <p>resulting in</p>
  
  <pre><code>|  Region  | # of page views | # of comments |
  |----------|-----------------|---------------|
  | Region 1 | 1100 (↑)        | 5 (-)         |
  | Region 3 | 1500 (-)        | 1 (-)         |
  </code></pre>
  
  <p>When I now receive an update for the month 1 scorecard, I also need to update the <code>previousValue</code> (and the <code>arrow</code>) property in the month 2 scorecard. Given that the structure might have changed, how can I do this update most efficiently? How can I "linked" the cells?</p>
  
  <p>In a RDBMS, I would have normalized the values in another table and just linked the valueIds. However, as any scorecard can have a lot of values, I assume that storing the valueIds in the scorecard documents and retrieving all values in a second step is really inefficient?!</p>
  
  <p>I have not decided on the NoSQL DB provider. Current favorite is CouchDb, but can also be MongoDB or DocumentDB. The backend is implemented in ASP.NET WebAPI.</p>