couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb-documentation] branch master updated: add docs around pagination (#158)
Date Wed, 16 Aug 2017 10:43:20 GMT
This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git


The following commit(s) were added to refs/heads/master by this push:
     new f7840d7  add docs around pagination (#158)
f7840d7 is described below

commit f7840d73fbee3d9998f48ecadc873a3bd7a3177b
Author: garren smith <garren.smith@gmail.com>
AuthorDate: Wed Aug 16 12:43:18 2017 +0200

    add docs around pagination (#158)
---
 src/api/database/find.rst | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/api/database/find.rst b/src/api/database/find.rst
index 5c29a7e..49db08d 100644
--- a/src/api/database/find.rst
+++ b/src/api/database/find.rst
@@ -54,9 +54,8 @@
         results you require. Used for paging through result sets. Every query
         returns an opaque string under the ``bookmark`` key that can then be
         passed back in a query to get the next page of results. If any part of
-        the query other than ``bookmark`` changes between requests, the results
-        are undefined. *Optional, default: null  Only for indexes of type
-        ``text``.*
+        the selector query changes between requests, the results
+        are undefined. *Optional, default: null*
     :<json boolean update: Whether to update the index prior to returning the
         result. Default is ``true``. *Optional*
     :<json boolean stable: Whether or not the view results should be returned
@@ -833,6 +832,22 @@ Example of selective retrieval of fields from matching documents:
             "fields": ["Actor_name", "Movie_year", "_id", "_rev"]
         }
 
+Pagination
+==========
+
+Mango queries support pagination via the bookmark field. Every `_find`
+response contains a bookmark - a token that CouchDB uses to determine
+where to resume from when subsequent queries are made. To get the next
+set of query results, add the bookmark that was received in the previous
+response to your next request. Remember to keep the `selector` the same,
+otherwise you will receive unexpected results. To paginate backwards,
+you can use a previous bookmark to return the previous set of results.
+
+Note that the presence of a bookmark doesn't guarantee that there are
+more results. You can to test whether you have reached the end of the
+result set by comparing the number of results returned with the page
+size requested - if results returned < `limit`, there are no more.
+
 .. _api/db/find/index:
 
 ================

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message