From user-return-17392-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon Aug 8 12:43:31 2011 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 BBD8988A6 for ; Mon, 8 Aug 2011 12:43:31 +0000 (UTC) Received: (qmail 52162 invoked by uid 500); 8 Aug 2011 12:43:30 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 52072 invoked by uid 500); 8 Aug 2011 12:43:28 -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 52064 invoked by uid 99); 8 Aug 2011 12:43:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 12:43:27 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeroentjevandijk@gmail.com designates 209.85.210.46 as permitted sender) Received: from [209.85.210.46] (HELO mail-pz0-f46.google.com) (209.85.210.46) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 12:43:23 +0000 Received: by pzk32 with SMTP id 32so2675257pzk.19 for ; Mon, 08 Aug 2011 05:43:03 -0700 (PDT) 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; bh=Ux95sdPUUNucfkYX1QTmsbeFYxnYffRSplwwXe/su0k=; b=ClhX33Wuch8XDmlcYbcz9TbYZu34QE5LGO0RdPwRuRxwnIYlq9IYK424/N4lPGdyDb CXpmO8PLAypBq/x459lsD3cQ13IkPHz3Y/oSXFXjx5IM4iOy/uOKc4/ZeNAon9B2tunn 7vlyRLpPNddRFVfUbgjJCPkihTfrJL7LhEECs= MIME-Version: 1.0 Received: by 10.142.76.17 with SMTP id y17mr3286772wfa.363.1312807383313; Mon, 08 Aug 2011 05:43:03 -0700 (PDT) Received: by 10.142.242.16 with HTTP; Mon, 8 Aug 2011 05:43:03 -0700 (PDT) In-Reply-To: References: <13241CB1-0BD1-4FBA-B09B-1536CD000822@gmail.com> Date: Mon, 8 Aug 2011 14:43:03 +0200 Message-ID: Subject: Re: How to use the changes feed with a view as filter From: Jeroen van Dijk To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=001636e90a96bdae8d04a9fdc9e6 --001636e90a96bdae8d04a9fdc9e6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Mon, Aug 8, 2011 at 2:17 PM, Sean Copenhaver wrote: > Oh wow, I was unaware that you could filter by view. The code indeed make= s > it look that way. I'm not sure which release this was done in though, or = if > you would need to build from latest source. > > Anyway, the code makes me think the request would be more like this: > GET > > http://myaccount.iriscouch.com/mydb/_change?filter=3D_view&view=3D_design= /mydb/_view/my_view > > Actually the following seems to be more of what I want, but apparently I'm not calling it correctly: GET http://myaccount.iriscouch.com/mydb/_changes?filter=3Dview&view=3Dmyview/my= _view =3D> {"error":"bad_request","reason":"filter parameter must be of the form `designname/filtername`"} > I get that from here: > > https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_changes.er= l#L144 > > Looks like those function clauses are to define the different built in > filters plus the last one to catch custom ones. The one on that line look= s > like what you are after and it's expecting a 'view' query string paramete= r > I > think. > > I believe the _design filter is to monitor for when a design document > changes and not to filter by a function inside of it. I don't have anythi= ng > setup to test this though. > I think you are right. > > Hopefully someone with not knowledge is able to confirm this and which > release this was in > Yes please. I think it is a 1.1 feature, but maybe you can only filter on doc ids and design docs: https://github.com/apache/couchdb/blob/trunk/CHANGES#L63 This is the original thread that gave me the impression it should be possible: http://comments.gmane.org/gmane.comp.db.couchdb.user/13364 On Mon, Aug 8, 2011 at 7:32 AM, Jeroen van Dijk > wrote: > > > I've tried to run the changes feed on a specific view, but so far I > haven't > > succeeded. I'm only able to use the 'doc_ids' filter, but I can't filte= r > > using a view. > > > > I've tried the following requests (using IrisCouch, couchdb version 1.1= ): > > > > GET > > http://myaccount.iriscouch.com/mydb/_changes?filter=3D_doc_ids&doc_ids= =3D[ > > "_design/mydb/_view/my_view] > > GET > > > http://myaccount.iriscouch.com/mydb/_changes?filter=3D_design&design=3D_d= esign/mydb/_view/my_view > > > > Both give me the same result whereas I would expect the 'filter=3D_desi= gn' > > to give me the result of the map function and not the changes of the > design > > document itself. The second request also works without the design > parameter: > > > > GET http://myaccount.iriscouch.com/mydb/_changes?filter=3D_design > > > > I think that also indicates I am doing something wrong. Anyone knows ho= w > to > > get this working? > > > > Thanks, > > > > Jeroen > > > > > > NB. My Erlang is not good enough to understand what exactly happens her= e: > > > https://svn.apache.org/repos/asf/couchdb/tags/1.1.0/src/couchdb/couch_cha= nges.erl > > > > > -- > =93The limits of language are the limits of one's world. =93 -Ludwig von > Wittgenstein > --001636e90a96bdae8d04a9fdc9e6--