couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <d...@muse.net.nz>
Subject Re: How to get the doc
Date Thu, 31 May 2012 20:07:44 GMT
On 31 May 2012 18:47, Stephan Bardubitzki <stephan@bardubitzki.com> wrote:
> Thanks Simon, much appreciated.
>
> Cheers,
> Stephan
>
>
>
> On 12-05-31 09:32 AM, Simon Metson wrote:
>>
>> I think in general you want to avoid emitting the doc body (for each view
>> that you do this you'll increase your database size by the size of your
>> documents). I vaguely recall someone saying it's faster to have the doc body
>> in the view (because there's one look up instead of two) but I've not
>> noticed it to be a problematic difference, and any non-trivial database is
>> going to be large enough to not want to include the doc body IMHO.
>> Cheers
>> Simon
>>
>>
>> On Thursday, 31 May 2012 at 17:20, Stephan Bardubitzki wrote:
>>
>>> Thanks, missed that. Would be this the best way to go in any case? Or
>>> are there scenarios where emitting doc is more appropriate?
>>>
>>> On 12-05-31 09:12 AM, Simon Metson wrote:
>>>>
>>>> Query the view with ?include_docs=true
>>>> http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
>>>>
>>>>
>>>> On Thursday, 31 May 2012 at 17:07, Stephan Bardubitzki wrote:
>>>>
>>>>> Somewhere I read that emitting doc._id and doc is a waste of resources
>>>>> and that they come for free.
>>>>>
>>>>> I know that doc._id comes for free, but how do I get the doc for
>>>>> example
>>>>> in this case:
>>>>>
>>>>> emit(doc.name (http://doc.name), null)
>>>>>
>>>>> Thanks.
>>>>> Stephan
>>>>>
>>>>
>>>>
>>>> --------------------------------
>>>> Spam/Virus scanning by CanIt Pro
>>>>
>>>> For more information see
>>>> http://www.kgbinternet.com/SpamFilter.htm
>>>>
>>>> To control your spam filter, log in at
>>>> http://filter.kgbinternet.com
>>>>
>>>
>>>
>>
>>
>> --------------------------------
>> Spam/Virus scanning by CanIt Pro
>>
>> For more information see
>> http://www.kgbinternet.com/SpamFilter.htm
>>
>> To control your spam filter, log in at
>> http://filter.kgbinternet.com
>>
>

The key thing here is to remember that views are stored in a separate
file on disk.
So when you emit(... ,doc) it is stashed in the view file.
?include_docs requires
reading then from 2 files, the view + the original .couch db file.

A+
Dave

Mime
View raw message