Search code examples
ionic-frameworkcouchdbreplicationpouchdbcouchdb-futon

CouchDB's replicated DB is a copy or reference to original?


As per http://guide.couchdb.org/draft/replication.html

Replication synchronizes two copies of the same database, allowing users to have low latency access to data no matter where they are. These databases can live on the same server or on two different servers—CouchDB doesn’t make a distinction. If you change one copy of the database, replication will send these changes to the other copy.

I have following 2 confisions:

  1. Does this mean that every replicated DB is a new DB/copy of original DB or does it refers to the original DB?
  2. On replication will it increase the size of DB?

Note: These confusions are in context of PouchDB(mobile) to CouchDB(server) interactions. To be more precise, I want to do something like https://stackoverflow.com/a/32206581/2904573

Have also gone through https://stackoverflow.com/a/4766398/2904573 but didn't got my answer.


Solution

  • I posted the same question on CouchDB github repo and got the answer.

    The replicated DB is a new copy. In the most general terms, it takes all the documents and attachments in the original DB (called the source) and puts them into a new DB (called the target).

    If the replication is a continuous replication, then the source is also then monitored for any new changes, and, if they are any, those change are copied to the target as well.

    Ref: https://github.com/apache/couchdb/issues/1494#issuecomment-410933908

    Thanks.