Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 28552 invoked from network); 12 Sep 2010 08:40:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Sep 2010 08:40:19 -0000 Received: (qmail 79179 invoked by uid 500); 12 Sep 2010 08:40:17 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 78758 invoked by uid 500); 12 Sep 2010 08:40:14 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 78747 invoked by uid 99); 12 Sep 2010 08:40:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Sep 2010 08:40:13 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebastiancohnen@googlemail.com designates 209.85.214.52 as permitted sender) Received: from [209.85.214.52] (HELO mail-bw0-f52.google.com) (209.85.214.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Sep 2010 08:40:08 +0000 Received: by bwz5 with SMTP id 5so4880283bwz.11 for ; Sun, 12 Sep 2010 01:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=Kf9hGdjcmSpoGY6lB4ci6cERdtPBWWM9rYU/8vs8o6U=; b=Gfqd5oa8wu6Z4Ti58j+A4kkcQ9mq0pjMs8m8HtVpiTn4giUH7N458mfKHx5tu7PPhr REKbmDdbkVqeRV2//1FyeRS/acecg/MryayECNZwEARbMkE4JryACdkwJ7cemhfsvc0P vi48u7IlA81htYlD3zT71toH+EssabBZTyrHE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=GgeXEFCWi4QV887NsfciVmwbWC2KOJtJTbbNW+hJcgB7wl0QJYkJQhPwVioPpvJMUL 50J16VRqtomqa6h90ABDCvWehO6HK64HweCWE4KJYsfVhq0QG2hMV91FzKXrhHkZv1Jd f6+M9wATsuwjnj+pq6bVZYLMfNhbqnSVtvFFs= Received: by 10.204.127.71 with SMTP id f7mr2089148bks.139.1284280784856; Sun, 12 Sep 2010 01:39:44 -0700 (PDT) Received: from [192.168.178.21] (koln-5d81bb3a.pool.mediaWays.net [93.129.187.58]) by mx.google.com with ESMTPS id x19sm3528812bkv.9.2010.09.12.01.39.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 12 Sep 2010 01:39:43 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: endkey doesn't obey limit parameter and always returns entries starting with offset 0 From: Sebastian Cohnen In-Reply-To: Date: Sun, 12 Sep 2010 10:39:41 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1081) Hey Henrik, this does not sound like a bug. You need to specify a startkey, if you want proper pagination. couch = streams results from the index from startkey to endkey, but limited to = the given limit parameter. if you don't provide a startkey, couch will = stream from the beginning (AFAIK) up to endkey when the limit of results = is hit (whichever comes first). this is the reason why you will always = see the first "page" in your application. I'm not sure if there is an example in the couchdb book or in the wiki, = but sofa (jchris' blog couchapp) has pagination build in. Maybe you can = have a look there (http://github.com/jchris/sofa). Pagination is best = build using startkey and limit. Best Sebastian On 12.09.2010, at 09:06, Henrik Skupin wrote: > Hi, >=20 > For my current Couch application I'm using pagination to show only 50 > results per page. To navigate back and forward the endkey vs. startkey > parameters are used. While startkey in combination with limit is = working > fine, endkey doesn't return results for [offset(endkey)-limit, > offset(endkey)] but for [0, limit]. This makes pagination impossible = for me > and looks like to be a bug. An example you can find here: >=20 > http://mozmill.hskupin.info/general/reports >=20 > After opening the page click 'Next' twice and check the URL of the > 'Previous' link before clicking on it. The endkey parameter will not = be > obeyed and a click on that link causes the first page to be opened. >=20 > The code can be found at: http://github.com/whimboo/mozmill-dashboard >=20 > Is the above problem a known broken behavior and worth filing a bug? >=20 > Thanks, > Henrik