From user-return-19187-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu Dec 22 00:15:58 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 42A697F40 for ; Thu, 22 Dec 2011 00:15:58 +0000 (UTC) Received: (qmail 94769 invoked by uid 500); 22 Dec 2011 00:15:56 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 94721 invoked by uid 500); 22 Dec 2011 00:15:56 -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 94713 invoked by uid 99); 22 Dec 2011 00:15:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2011 00:15:56 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [128.18.84.114] (HELO mailgate-internal4.sri.com) (128.18.84.114) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 22 Dec 2011 00:15:48 +0000 Received: from brightmail-internal2.sri.com (128.18.84.122) by mailgate-internal4.sri.com with SMTP; 22 Dec 2011 00:15:26 -0000 X-AuditID: 8012547a-b7ccaae000000cc8-bb-4ef2769da03c Received: from mars.esd.sri.com (mars.esd.sri.com [128.18.26.200]) by brightmail-internal2.sri.com (Symantec Brightmail Gateway) with SMTP id ED.CF.03272.D9672FE4; Wed, 21 Dec 2011 16:15:26 -0800 (PST) MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_u8Yy/cG3vSikB2LYUvEZ0w)" Received: from [192.12.16.233] by mars.esd.sri.com (Sun Java(tm) System Messaging Server 6.3-8.05 (built Sep 1 2009; 64bit)) with ESMTPSA id <0LWK005H0WPMCC10@mars.esd.sri.com> for user@couchdb.apache.org; Wed, 21 Dec 2011 16:15:22 -0800 (PST) From: Jim Klo Subject: Re: replication using an update handler? Date: Wed, 21 Dec 2011 16:15:25 -0800 In-reply-to: To: user@couchdb.apache.org References: <84F901D5-501B-46A0-903B-8A358473A39F@sri.com> Message-id: <5EF58423-024B-4E76-95BA-B79DBB3CFE3F@sri.com> X-Mailer: Apple Mail (2.1084) X-Brightmail-Tracker: AAAAAA== X-Virus-Checked: Checked by ClamAV on apache.org --Boundary_(ID_u8Yy/cG3vSikB2LYUvEZ0w) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Okay, I think I finally figured out how to get the validate_doc_update function to work. Now the question is... I only want to replicate some of the docs. Regardless of whether I return true or false all docs seem to replicate. Here's a link to the validate function: https://gist.github.com/1507943 My log shows nothing but thousands of lines like this: [Wed, 21 Dec 2011 23:51:15 GMT] [info] [<0.16027.7>] OS Process #Port<0.22580> Log :: validating for alignment. [Wed, 21 Dec 2011 23:51:15 GMT] [info] [<0.16027.7>] OS Process #Port<0.22580> Log :: 26120f9dccbe452abae585889988ff71-distributable is NOT being replicated. and none showing that it is replicating, however afaik, it's replicating everything, as my empty db, now has thousands of docs that shouldn't be there. The docs for the validate_doc_update seems to indicate to throw an error instead of returning true or false; however doing that causes replication to fail. What might I be doing wrong? Thanks, - Jim Jim Klo Senior Software Engineer Center for Software Engineering SRI International On Dec 20, 2011, at 12:57 PM, Dave Cottlehuber wrote: > On 20 December 2011 21:42, Jim Klo wrote: >> That's good - I was having a hard time understanding if that was source or destination. >> >> In my case we have multiple design docs in the same db. Do all the validate_doc_update functions (one in each design doc) get executed, or does one specifically get executed? if the later how does selection happen? > > All are run, and all must return true for the doc to be accepted. > >> Also if I'm using CouchApp to push - do I just place a file named validate_doc_update.js in the root of my app, or do I need to do that in the couchapp.json? > > Yes. > > These 2 links might be handy: > http://mindeavor.com/blog/the-anatomy-of-a-couchapp > https://github.com/jchris/couchapp.org/blob/master/validate_doc_update.js > > A+ > Dave --Boundary_(ID_u8Yy/cG3vSikB2LYUvEZ0w)--