Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 61056 invoked from network); 6 Feb 2011 00:36:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Feb 2011 00:36:37 -0000 Received: (qmail 47353 invoked by uid 500); 6 Feb 2011 00:36:36 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 47313 invoked by uid 500); 6 Feb 2011 00:36:35 -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 47305 invoked by uid 99); 6 Feb 2011 00:36:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Feb 2011 00:36:35 +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,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of randall.leeds@gmail.com designates 209.85.161.52 as permitted sender) Received: from [209.85.161.52] (HELO mail-fx0-f52.google.com) (209.85.161.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Feb 2011 00:36:28 +0000 Received: by fxm5 with SMTP id 5so3691551fxm.11 for ; Sat, 05 Feb 2011 16:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=oV86wXHkfFJPiPp5Sw5pMkRjgqG/NEGthR6pQn2Z0uY=; b=dwUjGU/xaqZY7eowoB13lt3MCSlcV2Tik1Rhv2oUiMtEmjcZMIsncVqRLddhrDvm+Q O13MqRDFBaY70c26vuw+0yOblak1kcu5DIoL8nweVrhD2fpPJS4rdiRgY7e5+dMoGsCo Q4+ZYoebIrHzyejb0xbXybxGwt4t97slz4BvA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=BXOuS1qf2EZkYRi+VlxYTrIr46RUxNZBPlpncxgPlKb50TR5WZEpnDZovXtrKVTQQr hrDxCQXBnI4IFrflR1dShzqVE8Hl+4ba3YhIe9MPzT67aEm83HCa37NzGTpVS2SNVPRG huxMt4I0DUNk+++JJDno+7sZnOGjHfNLBW/Vc= MIME-Version: 1.0 Received: by 10.223.72.202 with SMTP id n10mr5993431faj.74.1296952568364; Sat, 05 Feb 2011 16:36:08 -0800 (PST) Received: by 10.223.87.77 with HTTP; Sat, 5 Feb 2011 16:36:08 -0800 (PST) In-Reply-To: References: Date: Sat, 5 Feb 2011 16:36:08 -0800 Message-ID: Subject: Re: _changes and filters not working in harmony? From: Randall Leeds To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf3054a3d720bf27049b924de2 X-Virus-Checked: Checked by ClamAV on apache.org --20cf3054a3d720bf27049b924de2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I don't think there's anything wrong with what you're doing here, but I don't know the code too well. It sounds like what maybe we need is to pass the old document as a third parameter or something. On Sat, Feb 5, 2011 at 15:59, Timothy Wood wrote: > > I=E2=80=99ve been playing with the _changes support in concert with the f= ilter > parameter. I=E2=80=99m seeing some odd results, though. > > In all these cases, my filter function looks like: > > function(doc, req) { > if (doc.type =3D=3D "item" && doc["_attachments"]) { > return true; > } > return false; > } > > > 1) If I query for changes with a filter like: > > > http://status-board:5984/status-board/_changes?feed=3Dcontinuous&filter= =3Dapp/items > > I=E2=80=99ll see my test documents (that match the filter) come back. Gre= at. But > then if I go and delete a document using Futon, no =E2=80=9C_deleted=E2= =80=9D:true change > comes back. If I leave off the filter, I do get a _deleted entry in the > changes feed. > > 2) If I edit the document in Futon (by deleting its last attachment) so > that it no longer matches the filter, I don=E2=80=99t get a _deleted entr= y. I would > expect to get one since the change feed reported the document to me (it > matched the filter) and then it was edited to not match the filter. For a= n > observer following a filtered feed, this delete seems pretty crucial (if = you > wanted to do a filtered replication, for example). > > If I start a an unfiltered _changes feed and then do an insert of a > document followed by adding an attachment, I get two lines in the _change= s > feed. But, if I use the filter, I only get one. That is, unlike the delet= e > case, the filter doesn=E2=80=99t note the document until the document mat= ches the > filter. Probably a happy accident, but the mirror case (edit to not match > the filter) should be symmetric and issue a delete change. > > In my particular use case, I can probably just drop the filter on the > server side and do it in the client. Is there something wrong in my use o= f > _changes with a filter? I don=E2=80=99t see any discussion of this in the= book or on > the mailing list, but maybe I missed it. > > Thanks! > > -tim > > --20cf3054a3d720bf27049b924de2--