couchdb implementation of get and query().all()