Sam
Sam

Reputation: 766

How to display all documents in Couchdb using Python

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'])

Upvotes: 2

Views: 5103

Answers (1)

Sam
Sam

Reputation: 766

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

Upvotes: 6

Related Questions