Hi,
I'm trying to use the rewrite handler to clean up a list function URL,
but doesn't seem to work correctly. The view and list function work
fine without the rewrite.
The view and reduce output complex keys like so:
{"rows":[
{"key":[123456,"Alpha],"value":2},
{"key":[985323,"Bravo"],"value":1},
]}
and the view and list URL work correctly using these parameters:
http://couch:5984/db/_design/temp/_list/list/view?group=true&startkey=[123456,%22%22]&endkey=[123456,%22\u9999%22]
(Using vhosts) I'm trying to rewrite the ugly URL and parameters to be:
/owner/:owner/list
(where :owner is a numeric value)
The rewrite I wrote looks like this:
{
"from": "/owner/:owner/list",
"to": "_list/list/view",
"method": "GET",
"query": {
"group": true,
"startkey": [":owner", ""],
"endkey": [":owner", "\\u9999"]
}
}
However, this is getting rewritten to the following:
'GET' /db/_design/temp/_list/list/view?startkey=%5B%22%3Aowner%22%2C%22%22%5D&endkey=%5B%22%3Aowner%22%2C%22%5C%5Cu9999%22%5D&group=true&owner=123456
which does not throw an error, but returns an empty view since the
URL-encoded keys do not match anything.
Is there some way to do this with CouchDB rewrites? (Passing the
startkey and endkey parameters to the "nice" URL would defeat the
purpose of this rewrite)
Thanks