How to display all documents in Couchdb using Python

非 Y 不嫁゛ 提交于 2019-12-11 02:47:13

问题


I have recently started using Python. I have a database called student in Couchdb. I have attributes in it like [english, maths, science, total, percentage]. I want to display all the documents from my student database using python. I cant access all the documents. I tried following code but didnt work

couch = couchdb.Server()
db = couch['student']
rows = db.view('_all_docs', include_docs=True)
for row in rows:
    doc = db.get(row)
    print(doc['english'])

回答1:


import couchdb
couch = couchdb.Server('localhost:5984/')

db = couch['newtweets']
count = 0
for docid in db.view('_all_docs'):
    i = docid['id']
#and you are in each document


来源:https://stackoverflow.com/questions/37050231/how-to-display-all-documents-in-couchdb-using-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!