incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Per Ejeklint <ejekl...@mac.com>
Subject Dates as strings in lastkey? I'm lost in 0.10
Date Mon, 29 Jun 2009 13:47:07 GMT
I'm stuck with a really basic, stupid question about a couchapp  
running in 0.10. If I have data containing this

{
    "_id": "559884160",
    "_rev": "1-90616862",
    "timestamp": "2009/06/27 12:00",
    "doctype": "readings",
    "temp_outdoor": 21.6,
...
}

and a map function by_date like this:

function(doc) {
	if (doc.doctype == "readings") {
		emit(doc.timestamp, doc);
	}
}


and list function like this (simplified) producing csv data:

function(head, req) {
   start({headers: { 'Content-Type': 'text/csv; charset=utf-8' },  
body: ''});

   var row;
   while (row = getRow()) {
	var doc = row.value;
     if (doc.timestamp && doc.temp_outdoor) {
       send(doc.timestamp + ';' + doc.temp_outdoor + '\n');
     }
   }	
};

how on earth do I use startkey/endkey when calling? Like this doesn't  
work:

curl -vX GET ....mycouchapp.../_list/data/by-date?startkey="2009/06/29  
13:43"&endkey="2009/06/29 14:43"

Have tried all sorts of escaping and stuff but can't figure it out.  
Apparently I'm blind to something. Any hints?

Also, if I want to just get the latest 1000 docs, what would the call  
look like?

Lost in newbie space...

/Per

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message