title: How best create views for temporal data in couchbase
body: <p>I am interested in doing a website based on news, review articles etc.</p>
  
  <p>Some key information i need to check is that the articles is in a valid time range i.e. between its start date and stop date to run on the site and its online.</p>
  
  <p>How can i write a view for that? Ideally you would want a view like</p>
  
  <pre><code>var now = new Date();
  if(doc.online &amp;&amp; (doc.startDate &lt;= now &amp;&amp; now &lt;= doc.stopDate))
     emit(doc.headline,null);
  </code></pre>
  
  <p>but that wont work if i understand views correctly i.e. the only update on doc insert/update
  Do i really want to do a compound key that has the start and stop date in them so i can do range type queries and also have to deal with other complexities e.g. the type of article e.g. news, tagging of article etc.</p>
  
  <p>Thanks</p>