In the setup.sh file, we need to add the creation of a filter that can be used in CouchDB replication.
When replication occurs, it will move design documents only. These are the validation rules that we want to put on a standalone CouchDB instance that will act as a rules server. Creation of this filter should take place as part of the initial setup so that it can be used later in a replication step.
Implementation sketch
Define the filter function in a design document
This can be done as part of the initial setup in setup.sh.
{
"_id": "_design/filters",
"filters": {
"only_design_docs": "function(doc, req) { return doc._id.startsWith('_design/'); }"
}
}
Reference the filter in the replication document
This can be done later when we tackle replication.
{
"source": "my_source_db",
"target": "http://target_server:5984/my_target_db",
"filter": "filters/only_design_docs"
}
Important Considerations:
- Admin Privileges: When replicating design documents, especially if they are being created or updated on the target database, the user performing the replication (or the API key used) needs administrator privileges on the target database to ensure success.
In the
setup.shfile, we need to add the creation of a filter that can be used in CouchDB replication.When replication occurs, it will move design documents only. These are the validation rules that we want to put on a standalone CouchDB instance that will act as a rules server. Creation of this filter should take place as part of the initial setup so that it can be used later in a replication step.
Implementation sketch
Define the filter function in a design document
This can be done as part of the initial setup in
setup.sh.Reference the filter in the replication document
This can be done later when we tackle replication.
Important Considerations: