Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E78CB9F70 for ; Mon, 23 Apr 2012 15:52:04 +0000 (UTC) Received: (qmail 6563 invoked by uid 500); 23 Apr 2012 15:52:04 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 6515 invoked by uid 500); 23 Apr 2012 15:52:04 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 6507 invoked by uid 99); 23 Apr 2012 15:52:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 15:52:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 15:52:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id A968E40A08F for ; Mon, 23 Apr 2012 15:51:40 +0000 (UTC) Date: Mon, 23 Apr 2012 15:51:40 +0000 (UTC) From: "Robert Newson (JIRA)" To: dev@couchdb.apache.org Message-ID: <183338218.5185.1335196300728.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <825718102.5121.1335195094796.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1469) Filtered replication dies with criteria values not "root" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259679#comment-13259679 ] Robert Newson commented on COUCHDB-1469: ---------------------------------------- You'll be getting an exception for each doc that doesn't have a doc.Location. You should add guard clauses; function(doc, req) { return doc.Location && doc.Location.Region && doc.Location.Region === req.query.region; } http://wiki.apache.org/couchdb/Replication#Filtered_Replication > Filtered replication dies with criteria values not "root" > --------------------------------------------------------- > > Key: COUCHDB-1469 > URL: https://issues.apache.org/jira/browse/COUCHDB-1469 > Project: CouchDB > Issue Type: Question > Components: Replication > Affects Versions: 1.2 > Reporter: Alexandre Paulo > Priority: Minor > Labels: replication, replication_crash_with_filter > > << Excuse my english... I am portuguese >> > I have a document structure that goes like this: > { > "Location": { > "City": ..., > "Region": ..., > "Country": ... > } > } > I'd like to replicate my documents based on "Region", so, I wrote a filter function with > if (doc.Location.Region && doc.Location.Region == ...) { > return true; > } else { > return false; > } > But the replication dies with {"error":"changes_reader_died"} > I tested my function as a Map function on a view, just replacion "return true" with "emit (true)" and "return false" with "emit (false)" and it works fine. > After some testing I came to the conclusion that the replication filter function works fine with first-level fields (e.g. "doc.field") but dies with multi-level fields (e.g. "doc.parent.field") > In other words it does not compute "doc.Location.Region" on my filter function. I had to change my document structure to have "doc.Region". > Now my questions: > - is this a bug or is it intended to work this way? > - if it is intended why is it allowed on Map functions, but not on filter functions? > Thanks a lot! > << Excuse my english... I am portuguese >> -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira