title: MongoDB as a Time Series Database
body: <p>I'm trying to use mongodb for a time series database and was wondering if anyone could suggest how best to set it up for that scenario. </p>
  
  <p>The time series data is very similar to a stock price history. I have a collection of data from a variety of sensors taken from different machines. There are values at billion's of timestamps and I would like to ask the following questions (preferably from the database rather than the application level): </p>
  
  <ol>
  <li><p>For a given set of sensors and time interval, I want all the timestamps and sensor values that lie within that interval in order by time. Assume all the sensors share the same timestamps (they were all sampled at the same time). </p></li>
  <li><p>For a given set of sensors and time interval, I want every kth item (timestamp, and corresponding sensor values) that lie within the given interval in order by time. </p></li>
  </ol>
  
  <p>Any recommendation on how to best set this up and achieve the queries?</p>
  
  <p>Thanks for the suggestions. </p>