I read an article somewhere that using include_docs is "hard" on memory or
disk or in some way taxes Couch and therefore you should just emit the doc.
Is this true?


On Sun, Nov 10, 2013 at 5:11 PM, Mark Deibert <[email protected]>wrote:

> BTW, my current code _is_ storing each comment as it's own doc, and I
> already _do have_ and am using the view that is being described here. I was
> just trying to figure out something more denormalized. However, Keith's
> comment about the conflicts might be nail. I didn't think about that.
>
>
> On Sun, Nov 10, 2013 at 5:00 PM, Mike Marino <[email protected]> wrote:
>
>> Hi Mark,
>>
>> On Sun, Nov 10, 2013 at 10:10 PM, Mark Deibert <[email protected]>
>> wrote:
>> > Each comment is normally a very small amount of information, and id,
>> > userName, a date and a small text field. Probably no more than a short
>> > sentence on average. Why do I need to go through the trouble of creating
>> > new comment docs for each? This totally complicates the comment read
>> code
>> > (there will 1000 reads to every 1 write, at least) both in the UI and
>> the
>> > db for no reason.
>>
>> I'm not sure why this should complicate the comment read code.  You
>> can generate a view that emits as key the particular page/post to
>> which the comment refers.  As value, you can emit either a subset of
>> data you need from the comment, or simply emit "null" and call the
>> view with include_docs to get all the documents for the particular
>> post.  This would be a single http call.
>>
>> Cheers,
>> Mike
>>
>> >
>> >
>> > On Sun, Nov 10, 2013 at 1:34 PM, Jens Alfke <[email protected]> wrote:
>> >
>> >>
>> >> On Nov 9, 2013, at 11:47 AM, Robert Newson <[email protected]<mailto:
>> >> [email protected]>> wrote:
>> >>
>> >> attachments are different to documents. They're stored as a series of
>> >> binary chunks and so they can be streamed in and out, you can go large
>> >> with attachments.
>> >>
>> >> But on the other hand, all attachments will get copied during a
>> database
>> >> compaction, so they slow down the process and require more free disk
>> space.
>> >> If you have many gigabytes of attachments, you might consider storing
>> them
>> >> externally and putting URL links in the documents.
>> >>
>> >> As for comments, just add new documents for each comment and use a
>> >> view (https://wiki.apache.org/couchdb/HTTP_view_API,
>> >> https://wiki.apache.org/couchdb/View_collation) to bring the article
>> >> and comment thread together. No need to update a document that way.
>> >>
>> >> Yup. The guide <guide.couchdb.org<http://guide.couchdb.org>> has a
>> >> chapter-long example of a blog application that shows how to do
>> comments
>> >> this way.
>> >>
>> >> —Jens
>> >>
>>
>
>

Reply via email to