Search code examples
electroncouchdbpouchdb

PouchDB syncs to wrong CouchDB


I am using electronjs and pouchdb to sync data to a remote couchdb. I have a remote dev couchdb that I use for testing purposes and a remote production couchdb.

when I run electron . the application syncs the data from the remote db and stores documents locally electron's pouchdb and vice versa.

Things are fine but when I change the remote database URL from dev to prod, the locally stored dev data gets synced to the production couchdb.

Is there any way (programmatically) to stop this from happening?


Solution

  • You can not just change the URL of the remote database from Dev to Production.

    Pouchdb does not know that this are two different databases and therefor starts syncing. If you want a Dev and a Production Database you need to create two local databases. One that is synced with Dev and a separate one that is synced with Production.

    The strength of CouchDB is that it can sync with any other Couch.