【问题标题】:How to display all documents in Couchdb using Python如何使用 Python 在 Couchdb 中显示所有文档
【发布时间】:2016-08-31 05:16:26
【问题描述】:

我最近开始使用 Python。我在 Couchdb 中有一个名为 student 的数据库。我有一些属性,比如[英语、数学、科学、总数、百分比]。我想使用 python 显示我的学生数据库中的所有文档。我无法访问所有文件。我尝试了以下代码但没有用

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

【问题讨论】:

    标签: python database couchdb printdocument


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多