Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0EAA9AEE for ; Mon, 30 Jan 2012 01:01:40 +0000 (UTC) Received: (qmail 47751 invoked by uid 500); 30 Jan 2012 01:01:39 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 47574 invoked by uid 500); 30 Jan 2012 01:01:38 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 47566 invoked by uid 99); 30 Jan 2012 01:01:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2012 01:01:38 +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 paul.joseph.davis@gmail.com designates 209.85.220.180 as permitted sender) Received: from [209.85.220.180] (HELO mail-vx0-f180.google.com) (209.85.220.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2012 01:01:32 +0000 Received: by vcbfo1 with SMTP id fo1so3118537vcb.11 for ; Sun, 29 Jan 2012 17:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=GD3NZCFd6g8254fXpPgLqlR9wA11Odo1LclFJvw8hok=; b=llcAPlJMQOW/lLQcIYaU1q0W2gkztAeQw5NTF6j/76eGUQpaxPgFdyM9Rp+qni/umx BSiILZq2bqibnF9FwNoZf4SRCnx0tI8mMHLPupxjMlKb51rrhVwkFinefaa5ZxMDE80d Isd39B5jSETltoPs6WIhf+eEM4Kg/yOp05hbo= Received: by 10.220.232.74 with SMTP id jt10mr7986129vcb.21.1327885271177; Sun, 29 Jan 2012 17:01:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.7.208 with HTTP; Sun, 29 Jan 2012 17:00:31 -0800 (PST) In-Reply-To: References: From: Paul Davis Date: Sun, 29 Jan 2012 19:00:31 -0600 Message-ID: Subject: Re: Are CouchDB filters limited to the _changes feed? To: user@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 As Jim pointed out below this is basically a _list function. If you're worried about code duplication I'd suggest factoring out common logic and using commonjs modules. On Sun, Jan 29, 2012 at 10:54 AM, Daniel Gonzalez w= rote: > Hello, > > As specified=A0here > (http://guide.couchdb.org/draft/notifications.html#filters), a filter > can be used with the _changes feed like this: > > curl "$HOST/db/_changes?filter=3Dapp/important" > > Now I am trying to use this pattern with a standard view access, like thi= s: > > curl -X GET $HOST/db/_design/live_data/_view/all-comments&filter=3Dlive_d= ata/bytag?tag=3Dtesting > > I have also tried ? instead of &: > > curl -X GET $HOST/db/_design/live_data/_view/all-comments?filter=3Dlive_d= ata/bytag?tag=3Dtesting > > But the filter has no effect: all documents are shown, even those > which should not be validated by the filter. > > The filter that I am using is: > > function(doc, req) > { > =A0for( var i in doc.tags ) { > =A0 =A0if(doc.tags[i] =3D=3D req.query.tag) { > =A0 =A0 =A0return true; > =A0 =A0} > =A0} > =A0return false; > } > > - Am I doing something wrong in the curl calls? > - Is it at all possible to use views together with filters, or are > filters limited to the=A0_changes=A0feed? I have seen no examples of > filters except related to=A0_changes > > Thanks, > Daniel Gonzalez