-
Notifications
You must be signed in to change notification settings - Fork 9
Replication with view changes
Benoit Chesneau edited this page Jun 25, 2013
·
3 revisions
With the introduction of View changes, it is now possible to replicated all mapped document from one database to another. A View-based replication is significantly faster than filtering it using a function since all results are indexed. Replications over view changes can also be continuous.
The replication filter name is view
. (like in Apache CouchDb except that it will use a view index instead of folding a function over all documents). Like the filter function, parameters are added to query_params. Params are the same you use in [View changes](View-Changes].
Design doc:
{
"_id": "_design/test",
"views": {
"by_owner": {
"map": "function(doc) { if(doc.owner) emit(doc.owner, null); }",
"options": {
"seq_indexed": true
}
}
},
"options": {
"seq_indexed": true,
"include_deleted": true
}
}
replication doc:
{
"source": "testdb",
"target": "testdb1",
"filter": "_view",
"query_params": {
"view": "test/by_owner",
"key": "user3000"
}
}