couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Metson <>
Subject Re: No safe way to query and not ever reduce a view.
Date Thu, 10 Dec 2009 15:46:15 GMT
Why not duplicate the maps out of the views with a reduce. You'd then  
always query everything without ?reduce=false. Computing the views  
will not be more expensive if they're all in the same design doc.
Why can't your application know which views are what?

On 10 Dec 2009, at 15:27, Luke Sneeringer wrote:

> Greetings,
> So I'm in a situation here, and perhaps I'm missing something obvious.
> I have four views. They work fine. Two of them have reduce  
> functions, and two of them don't. On views with a reduce function,  
> CouchDB sends reduced replies unless you specifically tell it not  
> to. Anyway, in this particular instance, I want to query a view that  
> may or may not have a reduce function, but I want the non-reduced  
> results.
> This seems simple enough...just add ?reduce=false. However, if you  
> send ?reduce=false to a map-only view, you get an error from  
> CouchDB. I also can find no way to ask if a view is a map-view or a  
> map-reduce-view. In other words, if I have a view that may or may  
> not have a reduce function, the only way I can see to get non- 
> reduced results is to send a request with ?reduce=false, catch the  
> exception that's raised if it was a map-only view, and send the  
> query again without ?reduce=false.
> This feels quite clunky to me and not at all relaxing. I understand  
> the strict error checking, but I suppose it seems there should  
> either be a salient way to see which request form I should use, or  
> there should be a request form that works in both cases? If I don't  
> want reduced results, after all, it shouldn't matter if I have a  
> reduce function.
> Which brings me to the mailing list. Am I missing something? I  
> looked in the manual, and found nothing. Is this in CouchDB? If so,  
> how do I do it?
> Best Regards,
> Luke

View raw message