...
 
Commits (3)
......@@ -6,10 +6,11 @@
`replicate(source,target,name,extensions)`: replicate database `name` from `source` to `target` (all strings) by creating a replication `pull` document on the target.
Before submission, the replication document is passed to the (optional) `extensions` callback.
Returns a Promise. Make sure you `catch()` any errors.
An optional extra parameter might be used to name a distinct replicator database for storage (supported in CouchDB 2 and above).
module.exports = replicate = (prefix_source,prefix_target,name,extensions_cb) ->
module.exports = replicate = (prefix_source,prefix_target,name,extensions_cb,group_name = '') ->
replicator_db = "#{prefix_target}/_replicator"
replicator_db = "#{prefix_target}/#{group_name}_replicator"
replicator = new CouchDB replicator_db
Here we have multiple solutions, so I'll test them:
......
This diff is collapsed.
{
"name": "frantic-team",
"version": "1.4.2",
"version": "1.5.0",
"description": "Inject replication documents in CouchDB",
"main": "index.js",
"scripts": {
......
describe 'A basic replication', ->
replicate = require '..'
prefix = 'http://admin:[email protected]:5984'
prefix = "http://#{process.env.COUCHDB_USER}:#{process.env.COUCHDB_PASSWORD}@couchdb:5984"
CouchDB = require 'most-couchdb'
it 'should run', ->
@timeout 8000
await (new CouchDB "#{prefix}/_replicator").create()
await (new CouchDB "#{prefix}/example").create()
await replicate prefix, prefix, 'example'
describe 'A basic replication in a separate replicator database', ->
replicate = require '..'
prefix = "http://#{process.env.COUCHDB_USER}:#{process.env.COUCHDB_PASSWORD}@couchdb:5984"
CouchDB = require 'most-couchdb'
it 'should run', ->
@timeout 8000
await (new CouchDB "#{prefix}/test_replicator").create()
await (new CouchDB "#{prefix}/example2").create()
await replicate prefix, prefix, 'example2', null, 'test'