My CouchDB stores documents structured in the following way:
{
"_id": "1e8903e7b054c5129d3d5b605f000366",
"_rev": "1-f95adbeff8401059f55494da920e2725",
"person": "Rachel",
"age": 36
}
I'm trying to read contents of such documents using the following class method:
import couchdb
import credentials
class CouchDBConnector:
"""Database connector."""
couch = couchdb.Server(
f'http://{credentials.COUCHDB_USER}:{credentials.COUCHDB_PASSWORD}'
+ '@localhost:5984/')
def __init__(self, db_name):
self.db_name = db_name
def find_doc_by_name(self):
map_fun = '''function(doc) {
emit([doc.person, doc.age], doc.age);
}'''
for row in self.couch[self.db_name].query(map_fun):
print(row)
The query and map_fun
are taken directly from couchdb-python documentation. Yet, when trying to call the find_doc_by_name()
method:
cdb = CouchDBConnector('testdb')
cdb.find_doc_by_name()
I get the following error:
[...] raise ServerError((status, error))
couchdb.http.ServerError: (410, ('gone', 'Temporary views are not supported in CouchDB'))
Did I miss something while copying the documentation examples? Or has something changed recently and the docs weren't updated yet?
Apache CouchDB 3.2.2 is in use here.