Question

I'm attempting to replicate my local CouchDB database with a remote database that lives on iriscouch.com. I'm using nano.

This works fine -- except that the local documents are added to the existing iriscouch database rather than the local database being replicated on the remote.

Am I missing something?

Relevant code below.

nano.db.replicate(localCouchName, remoteCouchName,
  function(error, body) {
    if (error) {
    console.log('nano.db.replicate() error:', error);
    } else {
      console.log('nano.db.replicate() success', body);
    }
});
Was it helpful?

Solution

Replication is an additive operation, not a replacing operation. If you want your state on the remote to be exactly like the local state without any regard for what's currently on the remote node, you should probably just remove the database on the remote node prior to doing the replication.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top