title: Map Function with multiple keys
body: <p>I am running a couchDB Server with the following map function:</p>
  
  <pre><code>function(doc) {
              if (doc.data.appVersion)  {
                  emit([doc.data.appVersion, doc.data.date], doc);
              }
          }
  </code></pre>
  
  <p>I can easily query for a appVersion or a range of appVersion by using something like this:</p>
  
  <blockquote>
    <p>Start key: ["1.2.3", 0] End key: ["2.0.0", 10000000000000]</p>
  </blockquote>
  
  <p>I can also query for a appVersion between two dates:</p>
  
  <blockquote>
    <p>Start key: ["1.2.3", 1420066800000] End key: ["1.2.3", 1422572400000]</p>
  </blockquote>
  
  <p>What I can't do is to get all docs regardless of their appVersion but between two dates. This does not work:</p>
  
  <blockquote>
    <p>Start key: ["0.0.0", 1420066800000] End key: ["9.9.9", 1422572400000]</p>
  </blockquote>
  
  <p>The query would also include all docs with an appVersion between 0.0.0 and 9.9.9. The date is completely ignored. It is like:</p>
  
  <blockquote>
    <p>"get all docs with appVersion between 0.0.0 and 9.9.9 OR date between 1420066800000 and 1422572400000".</p>
  </blockquote>
  
  <p>But want I want is:</p>
  
  <blockquote>
    <p>"get all docs with appVersion between 0.0.0 and 9.9.9 AND date between 1420066800000 and 1422572400000"</p>
  </blockquote>
  
  <p>Is there a way to do all make all three query work? Do I have to change the map-function? How? Or do I have to create another map function just for that last kind of query. I'd like to do this with one map-function because there are more properties I'd like to query for.</p>
  
  <p>I am using couchDB with pouchDB on the client side.</p>