Add ability to use doc result of query, not just value
From the list:
Hi,
I've started working with the CouchRecord support and I've run into a bit of a problem with the queryView function. I've been writing views involving both map and reduce so I could generate statistics on some hierarchical data, and access leaves in one view, by using include_docs. As I discovered when my views returned no results in CouchRecord, its implementation is always using the "value" key in the returned row, whereas my views pulled the document in using the "doc" key.
For the present its fairly trivial for me to either split the view into two separate ones or perform a slightly cleverer reduce (I've only been counting totals so far), but it would be more convenient if it were possible to do everything in one view. Also, in CouchDB 0.11 they're adding support for linked documents in views, which will place the resulting documents in the "doc" key. The current implementation makes it impossible to use a linked document view to query.
Perhaps there could be a version of queryView that uses the "doc" key to generate the actual record, and provide it and the "value" key as a JValue in a tuple, as that value may be occasionally useful too?
Thanks,
Justin Reardon
Hi,
I've started working with the CouchRecord support and I've run into a bit of a problem with the queryView function. I've been writing views involving both map and reduce so I could generate statistics on some hierarchical data, and access leaves in one view, by using include_docs. As I discovered when my views returned no results in CouchRecord, its implementation is always using the "value" key in the returned row, whereas my views pulled the document in using the "doc" key.
For the present its fairly trivial for me to either split the view into two separate ones or perform a slightly cleverer reduce (I've only been counting totals so far), but it would be more convenient if it were possible to do everything in one view. Also, in CouchDB 0.11 they're adding support for linked documents in views, which will place the resulting documents in the "doc" key. The current implementation makes it impossible to use a linked document view to query.
Perhaps there could be a version of queryView that uses the "doc" key to generate the actual record, and provide it and the "value" key as a JValue in a tuple, as that value may be occasionally useful too?
Thanks,
Justin Reardon
Leave a comment