title: couchdb - startkey endkey doesn't filter records with key arrays as expected
body: <p>I have Couch-DB map-reduce view which outputs this;</p>
  
  <pre><code> {
  rows: [
      {
          key: [
              "2014-08-20",
              2,
              "registration"
          ],
          value: 2
      },
      {
          key: [
              "2014-08-20",
              2,
              "search"
          ],
          value: 3
      },
      {
          key: [
              "2014-08-21",
              2,
              "registration"
          ],
          value: 3
      },
      {
          key: [
              "2014-08-21",
              2,
              "search"
          ],
          value: 4
      }
  ]
  }
  </code></pre>
  
  <p>I need to query all the records that has between 2014-08-20 and 2014-08-21 Also the same time I need the integer value in the middle to be 2 and the last value to be "registration".</p>
  
  <p>My curl request URL looks like this </p>
  
  <pre><code>BASE_URL?group=true&amp;startkey=["2014-08-20",1,"registration"]
  &amp;endkey=["2014-08-21",1,"registration"]
  </code></pre>
  
  <p>This filters out the date but none of the other elements (the integer value and the string). Anyone got an idea whats happening?</p>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My Document structure looks something like this</p>
  
  <pre><code>[
      {
          platform_version: 2,
          UDID: "EWHSJeNp20sBFuzqcorkKVVi",
          session: {
              timestamp: "2014-08-20T00:00:00.000Z",
              session_id: "kOnNIhCNQ31LlkpEPQ7XnN1D",
              ip: "202.150.213.66",
              location: "1.30324,103.5498"
          },
          events: [
              {
                  event_type: "search",
                  timestamp: "2014-08-21T00:00:00.000Z",
                  location: "1.30354,103.5301",
                  attributes: {
  
                  }
              }
          ]
      },
      {
          platform_version: 2,
          UDID: "EWHSJeNp20sBFuzqcorkKVVi",
          session: {
              timestamp: "2014-08-21T00:00:00.000Z",
              session_id: "kOnNIhCNQ31LlkpEPQ7XnN1D",
              ip: "202.150.213.66",
              location: "1.30324,103.5498"
          },
          events: [
              {
                  event_type: "search",
                  timestamp: "2014-08-21T00:00:00.000Z",
                  location: "1.30354,103.5301",
                  attributes: {
  
                  }
              }
          ]
      },
      {
          platform_version: 2,
          UDID: "EWHSJeNp20sBFuzqcorkKVVi",
          session: {
              timestamp: "2014-08-20T00:00:00.000Z",
              session_id: "kOnNIhCNQ31LlkpEPQ7XnN1D",
              ip: "202.150.213.66",
              location: "1.30324,103.5498"
          },
          events: [
              {
                  event_type: "click",
                  timestamp: "2014-08-21T00:00:00.000Z",
                  location: "1.30354,103.5301",
                  attributes: {
  
                  }
              }
          ]
      }
  ]
  </code></pre>
  
  <p>and the map reduce function looks like this.</p>
  
  <pre><code>function(doc) {
  
  date = doc.session.timestamp.split("T")[0];
  eventArray = doc.events;
  for (i = 0; i &lt; eventArray.length; i++) { 
  
      emit([doc.app_version,eventArray[i].event_type,date],1);
  
  }
  
  
  }
  </code></pre>
  
  <p>It started working after I change the order of the keys. but still, I can't use a wildcard to query all the event types.</p>