couchdb-user mailing list archives

Jim Klo (2011-12-21 16:15):
> 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?
You want http://wiki.apache.org/couchdb/Replication#Filtered_Replication.
And then throw an error in validate_doc_update, so that unfiltered
replication fails.
--
-- Rogutės Sparnuotos