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

Reply via email to