On Fri, Oct 24, 2014 at 10:47:25PM +0000, Zack Gramana wrote: > +1 for adding doc pointer de-referencing before calling the map function.
Keep in mind the classic counter-argument from CouchDB about referencing external docs in map functions: map results are persisted at whatever time they're first calculated for a particular revision, so this makes the values in the view time-dependent. They would contain whatever properties the linked document happened to have at the time the index was run, and wouldn't change if the linked document changed. It also means that two replicating databases may have different view results with the same DB contents, if the two databases got their updates in a different order. > On Oct 24, 2014, at 3:44 PM, Traun Leyden > <[email protected]<mailto:[email protected]>> wrote: > But, I'm wondering is this the best practice or is there a better way? > @Jens I remember in your advanced couchbase lite talk you mentioned > "poor man's joins", but I didn't catch the details. Would that apply > here? I haven't had a chance to watch the talk yet (so pardon me if I'm way off-base), but usually Couch's "poor-man's joins" refers to the use of either linked documents[0] or view collation tricks[1] to get both the doc you're looking for and its related documents in the same view query. Those are both options that might be preferable to deduping the data. [0] http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Linked_documents [1] http://www.cmlenz.net/archives/2007/10/couchdb-joins (see section "Optimization: Using the Power of View Collation") - Matt -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/20141024232525.GA7372%40mqmb.local. For more options, visit https://groups.google.com/d/optout.
