dnolen dnolen - 2 months ago 9
Python Question

Multiple CouchDB Document fetch with couchdb-python

How to fetch multiple documents from CouchDB, in particular with couchdb-python?

Answer
import couchdb
import simplejson as json

resource = couchdb.client.Resource(None, 'http://localhost:5984/dbname/_all_docs')
params = {"include_docs":True}
content = json.dumps({"keys":[idstring1, idstring2, ...]})
headers = {"Content-Type":"application/json"}
resource.post(headers=headers, content=content, **params)
resource.post(headers=headers, content=content, **params)[1]['rows']
Comments