From dev-return-19914-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Wed Jan 4 23:06:18 2012 Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 59DF9B137 for ; Wed, 4 Jan 2012 23:06:18 +0000 (UTC) Received: (qmail 70686 invoked by uid 500); 4 Jan 2012 23:06:17 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 70650 invoked by uid 500); 4 Jan 2012 23:06:17 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 70640 invoked by uid 99); 4 Jan 2012 23:06:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jan 2012 23:06:17 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bchesneau@gmail.com designates 74.125.83.52 as permitted sender) Received: from [74.125.83.52] (HELO mail-ee0-f52.google.com) (74.125.83.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jan 2012 23:06:10 +0000 Received: by eeke52 with SMTP id e52so18121099eek.11 for ; Wed, 04 Jan 2012 15:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=wFSmIKDkJSZI1FTUAFRzneYIPQTtZMPGWlq+zGOznPc=; b=p0YX6oXzrOxMlPg8HOVYnfLBAfofvL1p9YA5tlypDIPm91qcwpAxnv7z33v2zCdN1b JVhNI9MXc/R2obOh+B4vo4PSXYXci3SDvD+Z73hNbU+B7Ot4IaOZ459r28QMONUMpjpa tqdTEPi0VsywPoK684p7i5eaKOdYoW061b+Vc= MIME-Version: 1.0 Received: by 10.14.29.77 with SMTP id h53mr24154105eea.51.1325718349836; Wed, 04 Jan 2012 15:05:49 -0800 (PST) Received: by 10.213.15.139 with HTTP; Wed, 4 Jan 2012 15:05:49 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Jan 2012 00:05:49 +0100 Message-ID: Subject: Re: proposal: Using the db hooks in other databases From: Benoit Chesneau To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Jan 4, 2012 at 11:55 PM, Filipe David Manana wrote: > On Wed, Jan 4, 2012 at 10:38 PM, Benoit Chesneau wr= ote: >> On Wed, Jan 4, 2012 at 11:35 PM, Filipe David Manana >> wrote: >>> While the use case for the system databases is clear, I wonder what >>> are the possible motivations to do it for regular databases. >>> >>> Does anyone has real world scenarios/examples where this level of >>> customization is useful and can't be done with the existing >>> infrastructure? >>> >>> >> Yes, read my example. > > Ok, I see. > > I wonder if adding on_changes and on_all_docs isn't a bit too much > complicated from a user's point of view. This si the only way imo to make sure that the final user, for example, can't see all docs or changes. We already use such trick for _replicator and _users dbs. The complication can be removed anyway if we make all these functions optional and provide sane defaults. > Following that reasoning, there should be a "on_view_with_include_docs_tr= ue". I don't think there is a need for that. In fact a a design document is a document like the others. Since it's always opened by `_design` functions, views and others are already handled in before_update/after_read. > > The after_read_doc callback should work for these 3 cases when > ?include_docs=3Dtrue is specified. > Sure, but include_docs is a special case. - beno=EEt