couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Klo <jim....@sri.com>
Subject Re: replication using an update handler?
Date Thu, 22 Dec 2011 00:15:25 GMT
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 <jim.klo@sri.com> 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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message