Reputation: 53
i would like to replicate all design docs and some docs that contain field clientId from orginal (A) to replication (B).
i have tried 2 ways but bothe have the same problem:
it updates my design docs continuously but not the normal docs with clientId. they only replicate one time on creation of replication.
1. try
curl -H 'Content-Type: application/json' \
-X POST http://admin:*******@mycare.owitec.lan:5984/_replicator \
-d '{
"continuous" : true,
"create_target" : true,
"source" : {
"url": "http://mycare.owitec.lan:5984/mycare_10001",
"headers": {
"Authorization": "Basic YWRtaW46QXNkZmdoKjU9"
}
},
"target" : {
"url": "http://mycare.owitec.lan:5984/mycare_rep_10001",
"headers": {
"Authorization": "Basic YWRtaW46QXNkZmdoKjU9"
}
},
"filter": "article/clientDataRep"
}'
function(doc, req) {
var v = doc._id.substr(0, 6);
if (v === '_desig' || v === '10001:') {
return true;
}
return false;
}
2. try
curl -H 'Content-Type: application/json' \
-X POST http://admin:********@mycare.owitec.lan:5984/_replicator \
-d '{
"continuous" : true,
"create_target" : true,
"source" : {
"url": "http://mycare.owitec.lan:5984/mycare_10001",
"headers": {
"Authorization": "Basic YWRtaW46QXNkZmdoKjU9"
}
},
"target" : {
"url": "http://mycare.owitec.lan:5984/mycare2_rep_10001",
"headers": {
"Authorization": "Basic YWRtaW46QXNkZmdoKjU9"
}
},
"selector": { "clientId": {"$exists": false} }
}'
i also checked both dbs for conflicts and there are none in both. what am i doing wrong? in other dbs where i have both-way-replication (from/to) i have no problems!
Upvotes: 0
Views: 93
Reputation: 53
it was the validate_doc_update function of a design document that checked 2 things:
if it is a update then you have to be the author or have a certain rule
according to doc.type object was only allowed certain fields and i had old data that didnt conform
the replication was always running i just didnt notice (think about) that the validate_doc_update was filtering it
Upvotes: 1