Skip to content

Instantly share code, notes, and snippets.

@tgrall
Created August 7, 2013 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tgrall/6176322 to your computer and use it in GitHub Desktop.
Save tgrall/6176322 to your computer and use it in GitHub Desktop.
from couchbase import Couchbase
cb = Couchbase.connect(bucket='beer-sample')
hasRow = True
rowPerPage = 5
page = 0
currentStartkey=""
startDocId=""
while hasRow :
hasRow = False
skip = 0 if page == 0 else 1
page = page + 1
print "-- Page %s --" % (page)
rows = cb.query("test", "by_country", limit=rowPerPage, skip=skip, startkey=currentStartkey, startkey_docid=startDocId)
for row in rows:
hasRow = True
print "Country: \"%s\" \t Id: '%s'" % (row.key, row.docid)
currentStartkey = row.key
startDocId = row.docid
print " -- -- -- -- \n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment