couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <>
Subject using replication internally in custom handlers
Date Wed, 18 Aug 2010 09:02:24 GMT
Hi all,

I'm writing a custom handler here and for specific reason I want a
continuous replication of one design doc from a db to another db on
the same CouchDB server :

start_replication(Name) ->
    SourceDb = ?l2b(couch_config:get("myproject", "db", "somedb")),
    {ok, RepDb} = couch_rep:ensure_rep_db_exists(),
    RepDoc = {[
            {<<"_id">>, couch_uuids:new()},
            {<<"source">>, SourceDb},
            {<<"target">>, Name},
            {<<"doc_ids">>, [<<"_design/somedesign">>]},
            {<<"continuous">>, true}

    couch_db:update_doc(RepDb, couch_doc:from_json_obj(RepDoc), []),


It works only for the first replication. When I check the active tasks
I can see the started replication, but updating the design doc on the
source db doesn't trigger replication. Any idea what could be the
problem here ?

- benoit

View raw message