couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zachary Zolton <zachary.zol...@gmail.com>
Subject Re: couchdb rewrite handler
Date Fri, 29 Jan 2010 21:47:37 GMT
Benoit,

Imagine you have a view of posts keyed by [user_name,date] but you
want to query a nice URL using just the user_name.

For example:

{
  Rest of design doc...

  "rewrite": [
    {
      "from": ":user_name/recent_posts",
      "to": "_view/recent_posts",
      "method": "GET",
      "query": {
        "descending": true,
        "limit": 20,
        "startkey": [":user_name",{}],
        "endkey": [":user_name"]
      }
    }
  ]
}

Do you think something like this could work? It would help me keep the
logic of how to query this view out of the client code.


Cheers,

Zach


On Fri, Jan 29, 2010 at 12:33 AM, Benoit Chesneau <bchesneau@gmail.com> wrote:
> I'v updated COUCHDB-591 ticket with latest diff:
>
> https://issues.apache.org/jira/browse/COUCHDB-591
>
> Tell me if it's ok for you so I can eventually commit it.
>
> - benoît
>
> On Fri, Jan 29, 2010 at 1:11 AM, Benoit Chesneau <bchesneau@gmail.com> wrote:
>> I've updated the rewrite handler on git repro. Some fixes and also
>> give support for relatives urls in the target :
>>
>>  this "to" urls are relative to ddoc :
>>
>>  _show/test/...
>> /_show/test/....
>>
>> give same results: /somedb/ddoc/_design/_show/test/...
>>
>> However it's now possible to do :
>>
>> ../../_changes -> /somedb/_changes
>>
>> and :
>>
>>  ../../../somedb -> /somedb
>>
>> or :
>>
>> ../../../_utils -> _utils
>>
>> I rewrite couch.it using the rewriter. It should be available this
>> weekend so we will have a working example.
>>
>> - benoît
>>
>>
>> - benoit
>>
>

Mime
View raw message