return doc.doc_type === "foo" || doc._deleted;

You're blocking deletes.

B.


On 22 May 2013 21:17, Jens Alfke <[email protected]> wrote:
>
> On May 22, 2013, at 1:09 PM, Daniel Myung <[email protected]> wrote:
>
>> I've got a changes listener with a filter on it that checks:
>>
>> return doc.doc_type == "foo";
>>
>> If I delete a document matching that criteria, I'm observing that it never
>> gets emitted on that filtered changes feed with that criteria and the
>> {"deleted": true } block.
>>
>> Is this expected behavior as designed?
>
> Yes, and this is a very common question. I think it’s come up on this list 
> within the past week.
>
> By default, when a document is deleted its contents are replaced with a 
> “tombstone” revision that just consists of {“_deleted”:true}. So a filter 
> that checks for any other properties won’t find them. The best solution is to 
> delete the document and still keep whatever properties your filter needs — 
> you can do that by updating the document with PUT and adding a 
> “_deleted”:true property to its contents. Or alternatively, I’ve heard you 
> can add a JSON HTTP body to the DELETE request, containing the extra 
> properties you want the ‘tombstone’ revision to have.
>
> —Jens

Reply via email to