title: MongoDB model for cross vendor time series data
body: <p>I know my problem seems better be solved by RDBMS models. But I really want to deploy it using MongoDB because I have potential irregular fields to add on each record in the future and also want to practice my NoSQL database skills.</p>
  
  <p>PE ratio and PB ratio data provided by one vendor:</p>
  
  <pre><code>| Vendor5_ID|   PE|    PB|date       |
  |----------:|----:|-----:|:----------|
  |        210| 3.90| 2.620|2017-08-22 |
  |        210| 3.90| 2.875|2017-08-22 |
  |        228| 3.85| 2.320|2017-08-22 |
  |        214| 3.08| 3.215|2017-08-22 |
  |        187| 3.15| 3.440|2017-08-22 |
  |        181| 2.76| 3.460|2017-08-22 |
  </code></pre>
  
  <p>Price data and analyst covering provided by another vendor</p>
  
  <pre><code>|Symbol | Price| Analyst|date       |
  |:------|-----:|-------:|:----------|
  |AAPL   |   160|       6|2017-08-22 |
  |MSFT   |   160|       6|2017-08-22 |
  |GOOG   |   108|       4|2017-08-22 |
  </code></pre>
  
  <p>And I have key convert data:</p>
  
  <pre><code>| uniqueID|Symbol |from       |to         |
  |--------:|:------|:----------|:----------|
  |        1|AAPL   |2016-01-10 |2017-08-22 |
  |        2|MSFT   |2016-01-10 |2017-08-22 |
  |        3|GOOG   |2016-01-10 |2017-08-22 |
  
  | uniqueID| Vendor5_ID|from       |to         |
  |--------:|----------:|:----------|:----------|
  |        1|        210|2016-01-10 |2017-08-22 |
  |        2|        228|2016-01-10 |2017-08-22 |
  |        3|        214|2016-01-10 |2017-08-22 |
  </code></pre>
  
  <p>I want to execute time range query fast. I come up with an idea that store each column as a collection, </p>
  
  <pre><code>db.PE:
  {
   _id,
   uniqueID, 
   Vendor5_ID,
   value,
   date
  }
  
  db.PB:
  {
   _id,
   uniqueID, 
   Vendor5_ID,
   value,
   date
  }
  
  db.Price:
  {
   _id,
   uniqueID, 
   Symbol,
   value,
   date
  }
  
  db.Analyst:
  {
   _id,
   uniqueID, 
   Symbol,
   value,
   date
  }
  </code></pre>
  
  <p>Is this a good solution? What model do you think is the best if there are far more data to add by different vendor?</p>