I am having this problem with couchdb replication: I am using the replicator db with this setup document:
{
"_id": "source_to_target",
"_rev": "1-2a6510e28c2cc7caf0d58a85d705d2b8",
"source": "http://xxxx:xxxx@localhost:5984/sourcedb",
"target": "targetdb",
"create_target": true,
"continuous": true,
"filter": "sourcedb/repl_filter",
"query_params": {
"someproperty": "somevalue"
},
"user_ctx": {
"name": "someadmin",
"roles": [
"_admin"
]
}
}
The problem is that the filter function gets ignored. I am sure it is correct because if I invoke:
curl -X GET "http://localhost:5984/sourcedb/_changes?filter=sourcedb/repl_filter&someproperty=somevalue&feed=continuous&style=all_docs&since=0"
the results are correctly filtered.
I perform the test as follows:
I erase the target db completely. Then I erase the above replication and recreate it from scratch. As soon as the replication document shown above gets commited, the replication starts and instead of the filtered docs, the target db gets ALL the docs, which constitutes my problem. The logs give a hint as to why:
[Fri, 20 Jul 2012 17:43:38 GMT] [info] [<0.5860.17>] Replication records differ. Scanning histories to find a common ancestor.
[Fri, 20 Jul 2012 17:43:38 GMT] [info] [<0.5860.17>] no common ancestry -- performing full replication
, which makes me scratch my head,because since I completely erase the target db before starting the replication, why search for common ancsestors with a not yet created db? Apparently I am missing something, but I cant figure it out. Any suggestions?