incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <jch...@gmail.com>
Subject Re: Adding attributes to a document in the view?
Date Thu, 18 Dec 2008 17:30:08 GMT
On Thu, Dec 18, 2008 at 9:09 AM, Daniel DeLeo <devnullian@gmail.com> wrote:
> I wasn't expecting these attributes to be saved, just returned (emitted).
> And I'll trust that docs are frozen before getting to the map function for
> good reason.

Deep copy would work. Still I think a deep copy of only the necessary
fields (as in my example) is good practice. Rarely in your application
will you need the whole document in the value of a view. By emitting
only the necessary data you'll get better performance and I think
cleaner application design.

There is also the include_docs query option, which is useful if you
occasionally want to access the doc, but usually just need what's
available in the value. (If you really do nearly always need the whole
doc(s) on view-range queries, it may be better to continue to emit it
in the value...)

-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message