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 E60CFD265 for ; Wed, 22 May 2013 20:18:26 +0000 (UTC) Received: (qmail 90626 invoked by uid 500); 22 May 2013 20:18:25 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 90567 invoked by uid 500); 22 May 2013 20:18:25 -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 90559 invoked by uid 99); 22 May 2013 20:18:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 20:18:25 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jens@couchbase.com designates 206.225.164.30 as permitted sender) Received: from [206.225.164.30] (HELO EXHUB020-3.exch020.serverdata.net) (206.225.164.30) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 20:18:21 +0000 Received: from EXVMBX020-1.exch020.serverdata.net ([169.254.4.122]) by EXHUB020-3.exch020.serverdata.net ([206.225.164.30]) with mapi; Wed, 22 May 2013 13:17:58 -0700 From: Jens Alfke To: "user@couchdb.apache.org" Date: Wed, 22 May 2013 13:17:54 -0700 Subject: Re: _changes feed with filter - does filter pick up deletions? Thread-Topic: _changes feed with filter - does filter pick up deletions? Thread-Index: Ac5XKXNZCVGVSnMTQ/ObKRyMIg3oSw== Message-ID: <56F6BD1C-9990-4F8B-BFAC-3C8337DC0FC0@couchbase.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org On May 22, 2013, at 1:09 PM, Daniel Myung wrote: > I've got a changes listener with a filter on it that checks: >=20 > return doc.doc_type =3D=3D "foo"; >=20 > If I delete a document matching that criteria, I'm observing that it neve= r > gets emitted on that filtered changes feed with that criteria and the > {"deleted": true } block. >=20 > Is this expected behavior as designed? Yes, and this is a very common question. I think it=92s come up on this lis= t within the past week. By default, when a document is deleted its contents are replaced with a =93= tombstone=94 revision that just consists of {=93_deleted=94:true}. So a fil= ter that checks for any other properties won=92t find them. The best soluti= on is to delete the document and still keep whatever properties your filter= needs =97 you can do that by updating the document with PUT and adding a = =93_deleted=94:true property to its contents. Or alternatively, I=92ve hear= d you can add a JSON HTTP body to the DELETE request, containing the extra = properties you want the =91tombstone=92 revision to have. =97Jens=