couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <randall.le...@gmail.com>
Subject Re: Next and previous element.
Date Tue, 22 Jun 2010 17:46:35 GMT
Huh. I could have sworn this conversation just happened on irc last week
with the opposite conclusion.

On Jun 22, 2010 5:45 AM, "Paul Bonser" <misterpib@gmail.com> wrote:

On Tue, Jun 22, 2010 at 12:34 AM, Randall Leeds <randall.leeds@gmail.com>
wrote:
> Not so easy, Paul...
What? Yes it does! That's exactly what it does! That's why when you
add descending=true, you have to swap your startkey and endkey. But in
this case, he want the item immediately before and after the current
item, so he can use the same key.

I checked to make sure you didn't know something I didn't:

   $ curl localhost:5984/orderdb/_all_docs
   {"total_rows":3,"offset":0,"rows":[

 {"id":"a1","key":"a1","value":{"rev":"1-6e15c8b45b11569dcce6e9ebe57e7ed0"}},

 {"id":"a2","key":"a2","value":{"rev":"1-8a6a10dcc1da8f963978d778f63186ab"}},

 {"id":"a3","key":"a3","value":{"rev":"1-8b1e13f02821b82f945f1459202db018"}}
   ]}

   $ curl 'localhost:5984/orderdb/_all_docs?startkey=%22a2%22&skip=1'
   {"total_rows":3,"offset":1,"rows":[

 {"id":"a3","key":"a3","value":{"rev":"1-8b1e13f02821b82f945f1459202db018"}}
   ]}

   $ curl
'localhost:5984/orderdb/_all_docs?startkey=%22a2%22&skip=1&descending=true'
   {"total_rows":3,"offset":2,"rows":[

 {"id":"a1","key":"a1","value":{"rev":"1-6e15c8b45b11569dcce6e9ebe57e7ed0"}}
   ]}




>
> On Mon, Jun 21, 2010 at 18:21, Paul Bonser <misterpib@gmail.com> wrote:
>> What you probably ...
--

Paul Bonser
http://probablyprogramming.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message