`load_document` loads `_all_docs` instead of directly querying the document
daroczig opened this issue · comments
I was debugging some of my CouchDB views when I realized that couch_potato
's load_document
triggers a query to http://host:port/db/_all_docs?include_docs=true
and grabs the document from that view.
Is it normal? Fetching the document directly would be a lot faster way IMHO, like loading http://host:port/db/id
instead.
Hm. Couch Potato just uses couchrest to load documents. When you call load
it either calls get
on a couchrest database object or calls bulk_load
. I have no idea why couchrest would query _all_docs
for any of these, but maybe if you open an issue there we can find out.
Thanks a lot for your quick response and for the links, you helped me a lot.
I've found out that we somehow passed an Array
of only one String
to load_document
instead of a String
, so bulk_load
was called there. And bulk_load
queries _all_docs
it seems, which is pretty reasonable anyway.
Thanks again!