title: How to query a couchdb view using a composite key?
body: <p>I have a couchdb view "record_by_date_product" with the following definition:</p>
  
  <pre><code>function(doc) {
    emit([doc.logtime, doc.product_id], doc);
  }
  </code></pre>
  
  <p>I am trying to run a query which is something like:</p>
  
  <pre><code>(logtime &gt; fromdate &amp; logtime &lt; todate)  &amp; product_id in (1,2,6)
  </code></pre>
  
  <p>Is this possible with this view?</p>
  
  <p>I am also using couchdb python library to access couchdb. Here is a code snippet:</p>
  
  <pre><code>server = couchdb.Server()
  db = server['mydb']
  
  results = db.view('_design/record_by_date_product/_view/record_by_date_product')
  </code></pre>
  
  <p>This page <a href="http://packages.python.org/CouchDB/client.html#viewresults" rel="noreferrer">http://packages.python.org/CouchDB/client.html#viewresults</a> specifies that we can use a startkey and endkey. But I am not able to get it working. </p>
  
  <p>Thanks</p>