Can I use CouchDB's new partitioned databases to only replicate a specific partition?

594 views Asked by At

I'm super excited about CouchDB 3, especially the Partitioned Database feature. I would like to set up something similar to envoy, where you have one database that syncs to many smaller databases.

I was wondering, what's the best way to implement one partition for one user, and only enable users to sync their own partitions. Is it possible to have global changes split into partition changes, using that log for syncing, or is that overthinking on my part?

3

There are 3 answers

1
Gadi Toledano On

You can add a selector to the replication document.

"selector": { "_id": { "$regex": "^[PartitionName]:" } }
1
Gadi Toledano On

You are right , the brackets expression should be replace by the actual partition name - final expression should be without brackets..

0
Gadi Toledano On

You can add a selector to the replication document.

e.g.

"selector": { "_id": { "$regex": "^CANADA:" } }

or

"selector": { "_id": { "$regex": "^USA:" } }