Skip to content

Commit

Permalink
Create mr-view.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shuff1e authored Nov 30, 2018
1 parent ac7fd94 commit 59142d6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions python/mr-view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

from couchbase.bucket import Bucket

# for more
# https://pythonhosted.org/couchbase/api/couchbase.html
# http://docs.couchbase.com/sdk-api/couchbase-python-client-2.0.0-beta2/api/couchbase.html
bucket = Bucket("couchbase://127.0.0.1:8091/bbtest", password='123456')

design_document = 'bbtest'
view = 'bbtest'

view_results = bucket.query(design_document, view, limit=10)
count = 0
for result in view_results:
print result.key
count += 1
assert count < 10

0 comments on commit 59142d6

Please sign in to comment.