dnolen dnolen - 1 year ago 105
Python Question

Multiple CouchDB Document fetch with couchdb-python

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

Answer Source
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']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download