lightcouch / LightCouch

CouchDB Java API
www.lightcouch.org
Apache License 2.0
67 stars 70 forks source link

docs for View.query() when include_docs=false #60

Open srl295 opened 8 years ago

srl295 commented 8 years ago

Looking at https://github.com/lightcouch/LightCouch/blob/master/src/main/java/org/lightcouch/View.java#L162

…when include_docs=false (as in a reduce), the Class<T> classOfT is applied to the entire row {key: …, value: …}, not just the value. This probably should be documented.

Got bit by this by switching a view from reduce=false&include_docs=true to reduce=true&include_docs=false and the query no longer worked, even though the Class used should have been sufficient.

srl295 commented 8 years ago

It's probably not a good idea to make a breaking change to this function. SO the path of least resistance would be something like:

 * note: if include_docs=false, classOfT is deserialized from the entire row { key: ≈, value: ≈ }
 * — consider using queryView() instead.