title: Couchdb Map function to get the data in between two dates
body: <p>I have set of docs in my couchdb here I mentioned one sample doc:</p>
  
  <pre><code>{
  "_id": "26",
  "_rev": "1-53ac67e9ec4b4ce8ffa9cd609e107aaf",
   "customer_name": "Vadilal",
  "type": "trip",
  "duration": "10 hours 27 mins",
  "end_time": "Jan 1, 2014 10:11:00 PM",
  "start_time": "Jan 11, 2014 8:46:00 AM",
  }
  </code></pre>
  
  <p>If I pass <code>timestamp(key)</code> from the URL, if it is in between <code>start_time</code> and <code>end_time</code> then i want to get the docs.</p>
  
  <p>Example:</p>
  
  <p>suppose url would be like this</p>
  
  <pre><code>   .../trip/_design/trip/_view/trip?key="Jan 10, 2014 8:46:00 AM"
  </code></pre>
  
  <p>Here I am passing timestamp as <code>Jan 10, 2014 8:46:00 AM</code> so it comes in between <code>start_time</code> and <code>end_time</code> of above mentioned doc, in this case I need fetch the remaining information.</p>
  
  <p>Kindly help to figure out this problem, it would be great help to me.</p>
  
  <p>I have written function like below :   </p>
  
  <pre><code>    function(doc){
      if(doc.type=="trip"){ 
     var startTime=new Date(doc.start_time);
     var endTime=new Date(doc.end_time);
    emit([startTime.getTime(),endTime.getTime()], doc);
      }
  </code></pre>
  
  <p>And calling URL as below :</p>
  
  <pre><code>../trip/_design/trip/_view/trip?startkey=[1390086890000]&amp;endkey=[1390086890000,{}]
  </code></pre>
  
  <p>is above one correct according to my requirement???</p>