You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Oliver Schmidt <ol...@orlives.de> on 2014/01/02 12:55:10 UTC

Proble with rewriting to list functions

Hi,
I have the following strange problem: I want to rewrite an URL to trigger a 
_list function which should display data supplied by a view. The does both 
map and reduce, but for this list funtion I don't need the reduce step, so I 
supplied the query argument reduce=false. This is the rewrite I use:

	{from: '/tags', to: '_list/testList/tags', query: { reduce:false}},

The strange error I encounter is that the rewrite URL 
http://localhost:5984/recipes/_design/recipe-couch/_rewrite/tags gives me 
the error message {"error":"unknown_error","reason":"badarg"}. If I 
trigger the list function directly via 
http://localhost:5984/recipes/_design/recipe-couch/_list/testList/tags?reduce=false or not supply the reduce=false 
query argument in the rewrite, everything works fine.
Is this a bug in CouchDB or am I doing something wrong?

Regards, Oliver

Re: Proble with rewriting to list functions

Posted by Oliver Schmidt <ol...@orlives.de>.
Great, it works now. I didn't know that "false" is just a string and not it's 
own type like in Python
SOLVED

Am Donnerstag, 2. Januar 2014, 03:58:26 schrieb Stanley Iriele:
> The 1st thing I see right off the bat is that that is not valid json... The
> keys need to be in quotes because they are strings... Second.. They 
query
> arg needs to be a string too... I believe...I haven't used them in a
> while...either way that's not valid json.
> On Jan 2, 2014 6:54 AM, "Oliver Schmidt" <ol...@orlives.de>
> 
> wrote:
> > Hi,
> > I have the following strange problem: I want to rewrite an URL to 
trigger
> > a
> > _list function which should display data supplied by a view. The does 
both
> > map and reduce, but for this list funtion I don't need the reduce step, 
so
> > I
> > 
> > supplied the query argument reduce=false. This is the rewrite I use:
> >         {from: '/tags', to: '_list/testList/tags', query: {
> >         reduce:false}},
> > 
> > The strange error I encounter is that the rewrite URL
> > http://localhost:5984/recipes/_design/recipe-couch/_rewrite/tags gives 
me
> > the error message {"error":"unknown_error","reason":"badarg"}. If I
> > trigger the list function directly via
> > 
> > http://localhost:5984/recipes/_design/recipe-couch/_list/testList/tags?red
> > uce=falseor not supply the reduce=false query argument in the 
rewrite,
> > everything works fine.
> > Is this a bug in CouchDB or am I doing something wrong?
> > 
> > Regards, Oliver


Re: Proble with rewriting to list functions

Posted by Stanley Iriele <si...@gmail.com>.
The 1st thing I see right off the bat is that that is not valid json... The
keys need to be in quotes because they are strings... Second.. They query
arg needs to be a string too... I believe...I haven't used them in a
while...either way that's not valid json.
On Jan 2, 2014 6:54 AM, "Oliver Schmidt" <ol...@orlives.de>
wrote:

> Hi,
> I have the following strange problem: I want to rewrite an URL to trigger a
> _list function which should display data supplied by a view. The does both
> map and reduce, but for this list funtion I don't need the reduce step, so
> I
> supplied the query argument reduce=false. This is the rewrite I use:
>
>         {from: '/tags', to: '_list/testList/tags', query: { reduce:false}},
>
> The strange error I encounter is that the rewrite URL
> http://localhost:5984/recipes/_design/recipe-couch/_rewrite/tags gives me
> the error message {"error":"unknown_error","reason":"badarg"}. If I
> trigger the list function directly via
>
> http://localhost:5984/recipes/_design/recipe-couch/_list/testList/tags?reduce=falseor not supply the reduce=false
> query argument in the rewrite, everything works fine.
> Is this a bug in CouchDB or am I doing something wrong?
>
> Regards, Oliver
>