couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: View key parameters in _rewrite
Date Fri, 30 Apr 2010 20:45:14 GMT

On Apr 30, 2010, at 1:35 PM, Zachary Zolton wrote:

> @JChris thanks for the workaround! Unfortunately, given that
> ":bindvar" doesn't encode the value but [":bindvar"] does, I'm not
> sure if there can be a way to add this kind of flexibility without
> breaking compatibility with 0.11...
> 
> @Benoit this all works fine with numbers, since they don't need
> anything to be correctly encoded as JSON keys. If you try non-numeric
> string values CouchDB rightfully complains about invalid JSON.
> 
> How do you guys feel about my aforementioned rewriter syntax suggestion?
> 
> {
> "from": "/tags/:tagname",
> "to": "_view/by-tag",
> "query": {
>   "key": { "name": ":tagname", "json_encode": true }
> }
> }
> 

I wish there was a way to do it that wasn't so different from how you'd express it with the
default value. But I'm afraid there's not.

I think this will be backwards compatible with 0.11, eg:

{
"from": "/tags/:tagname",
"to": "_view/by-tag",
"query": {
  "key" : ":tagname"
}
}

would still work as it does today.

So yeah, I'm into it.

Thanks!

Chris
Mime
View raw message