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

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?



Solution 1:[1]

You can add a selector to the replication document.

"selector": { "_id": { "$regex": "^[PartitionName]:" } }

Solution 2:[2]

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

Solution 3:[3]

You can add a selector to the replication document.

e.g.

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

or

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dula
Solution 2 Gadi Toledano
Solution 3 Suraj Rao