couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee Nelson <lnel...@nelnet.org>
Subject Query by specific date vs range
Date Mon, 18 Oct 2010 23:29:47 GMT
When I query using a date range (startkey and endkey) I get a
response, however when I query by a single date (key=), I get no
response.  Examples:

http://10.0.1.136:5984/netelligence/_design/telemetry/_view/usage_dates?key="2010/10/15
21:20:00 +0000"
Returns:
{"total_rows":886,"offset":1,"rows":[]}

However:
http://10.0.1.136:5984/netelligence/_design/telemetry/_view/usage_dates?startkey="2010/10/15
20:15:00 +0000"&endkey="2010/10/15 21:20:00 +0000"
Returns:
{"total_rows":888,"offset":0,"rows":[
{"id":"7963df3f-a271-8da4-3b66-c5a0ed16d0bd","key":"2010/10/15
21:15:00 +0000","value":null}
]}

I'm also perplexed by the fact that the range query only returns one
row when there are entries at 21:15 and 21:20.  Why, when I query by
"key" do I get nothing and when I query by start- and endkey, do I
only get one of the two values in the range?  I've been banging my
head against this for two days.

My map function:
function(doc) {
    if(doc.sampletime) {
        emit(doc.sampletime, null);
    }
}

There is no reduce function.

Here's an example document:
{
   "_id": "ff41b06d-d19c-0275-abac-a38798e9bdbe",
   "_rev": "1-3986507576f0da9fd5be20fd88724df1",
   "category": "telemetry",
   "type": "usage",
   "measurement": "bandwidth",
   "device": "rtr02-frfd",
   "sampletime": "2010/10/17 06:35:00 +0000",
   "ports": [
       {
           "Gi8/36": [
               {
                   "InOctets": 0,
                   "InUcastPkts": 0,
                   "InMcastPkts": 0,
                   "InBcastPkts": 0,
                   "OutOctets": 0,
                   "OutUcastPkts": 0,
                   "OutMcastPkts": 0,
                   "OutBcastPkts": 0
               }
           ],
           "Gi4/0/5": [
               {
                   "InOctets": 0,
                   "InUcastPkts": 0,
                   "InMcastPkts": 0,
                   "InBcastPkts": 0,
                   "OutOctets": 0,
                   "OutUcastPkts": 0,
                   "OutMcastPkts": 0,
                   "OutBcastPkts": 0
               }
           ]
       }
   ]
}

Mime
View raw message