http://guide.couchdb.org/draft/views.html#reversed http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
On 16.12.2010, at 13:39, Fabio Batalha wrote: > Ok now I understand. > > It's working now. > > Do you know a better place to read and learn those tricks. I didn't found > any issue about the flip in the wiki and in the book couchdb definitive > guide. > > Many thanks > Fabio Batalha > > On Thu, Dec 16, 2010 at 10:27 AM, Sebastian Cohnen < > [email protected]> wrote: > >> Unless I missed something you didn't flip the startkey/endkey parameters >> again. You need to do this, since couch is not sorting the result but >> reading the index backwards. >> >> So if you want to have your results for your query >> ?startkey=[%22arg%22,{}]&endkey=[%22arg%22] descending, you have to flip the >> paramters like this: >> ?startkey=[%22arg%22]&endkey=[%22arg%22,{}]&descending=true >> >> On 16.12.2010, at 13:20, Fabio Batalha Cunha dos Santos wrote: >> >>> Yes, >>> >>> This issue was understood. >>> >>> But when I want just a single key the flit did not take effect once the >>> startkey is the same of the endkey. >>> >>> For example: >>> >>> These are my keys. >>> >>> "key":["arg","20101000"] >>> "key":["arg","20101000"] >>> "key":["arg","20101100"] >>> "key":["arg","20101100"] >>> "key":["scl","20101000"] >>> "key":["scl","20101000"] >>> "key":["scl","20101100"] >>> >>> I want to get only the key="arg" so my query is: >>> ?startkey=[%22arg%22,{}]&endkey=[%22arg%22] >>> For this query the result is: >>> "key":["arg","20101000"] >>> "key":["arg","20101000"] >>> "key":["arg","20101100"] >>> "key":["arg","20101100"] >>> >>> That's perfect. >>> >>> Now I want to enable the descending true expecting the result >>> bellow.The idea is to bring at first the most recent registers because >>> the second parameter is ISO DATE.So my query is: >>> ?startkey=[%22arg%22,{}]&endkey=[%22arg%22]&descending=true >>> >>> "key":["arg","20101100"] >>> "key":["arg","20101100"] >>> "key":["arg","20101000"] >>> "key":["arg","20101000"] >>> >>> Instead of this result I have a empty list. >>> >>> Thanks, >>> *Fabio Batalha C. Santos* >>> Colegiado SciELO >>> www.scielo.org >>> FAPESP - CNPq - BIREME - FapUNIFESP >>> >>> >>> >>> On Wed, Dec 15, 2010 at 7:49 PM, Nils Breunese <[email protected]> >> wrote: >>> >>>> You quite literally need to flip your startkey and endkey, so you'll >> need >>>> to query with >> ?startkey=[%22arg%22,{}]&endkey=[%22mex%22]&descending=true >>>> >>>> Nils. >>>> ________________________________________ >>>> Van: Fabio Batalha Cunha dos Santos [[email protected]] >>>> Verzonden: woensdag 15 december 2010 21:24 >>>> Aan: [email protected] >>>> Onderwerp: Re: Doubts with start and end keys + descending=true >>>> >>>> Now the descending parameter is working but I'm still not having the >>>> expected result. >>>> >>>> For example: >>>> >>>> 1. Results from arg to mex in ascending mode. >>>> >>>> >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22arg%22]&endkey=[%22mex%22,{}] >> < >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22arg%22]&endkey=[%22mex%22,%7B%7D] >>> >>>> >>>> the result have arg,chl and mex keys. That's ok! >>>> >>>> 2. Now flipping. Results from mex to arg in descending mode. >>>> >>>> >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22mex%22]&endkey=[%22arg%22,{}]&descending=true >> < >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22mex%22]&endkey=[%22arg%22,%7B%7D]&descending=true >>> >>>> >>>> the result have only keys = "chl". That isn't ok, I was expecting mex, >> chl >>>> and arg in the descending mode. >>>> >>>> Other Example: >>>> >>>> 1. Results with keys = arg >>>> >>>> >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22arg%22]&endkey=[%22arg%22,{}] >> < >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22arg%22]&endkey=[%22arg%22,%7B%7D] >>> >>>> >>>> the result is a list with key = arg. That's ok! >>>> >>>> >>>> >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22arg%22]&endkey=[%22arg%22,{}]&descending=true >> < >> http://fabiobatalha.couchone.com/scieloorg/_design/couchdb/_view/article_date?startkey=[%22arg%22]&endkey=[%22arg%22,%7B%7D]&descending=true >>> >>>> >>>> In this example I can't just flip the key values once I'm filtering only >>>> one >>>> key value "arg" >>>> the result is a empty list with. That isn't ok, I was expecting a >> key="arg" >>>> list in the descending mode >>>> >>>> Thanks, >>>> *Fabio Batalha C. Santos* >>>> Colegiado SciELO >>>> www.scielo.org >>>> FAPESP - CNPq - BIREME - FapUNIFESP >>>> >>>> >>>> >>>> On Wed, Dec 15, 2010 at 5:08 PM, Matthew Woodward < >> [email protected] >>>>> wrote: >>>> >>>>> On Wed, Dec 15, 2010 at 10:58 AM, Sebastian Cohnen < >>>>> [email protected]> wrote: >>>>> >>>>>> try to flip startkey/endkey when discending=true :) >>>>>> >>>>> >>>>> Yep, ran into this just yesterday and that was indeed the trick. >>>>> -- >>>>> Matthew Woodward >>>>> [email protected] >>>>> http://blog.mattwoodward.com >>>>> identi.ca / Twitter: @mpwoodward >>>>> >>>>> Please do not send me proprietary file formats such as Word, >> PowerPoint, >>>>> etc. as attachments. >>>>> http://www.gnu.org/philosophy/no-word-attachments.html >>>>> >>>> ------------------------------------------------------------------------ >>>> VPRO www.vpro.nl >>>> ------------------------------------------------------------------------ >>>> >> >>
