Selective replication

I would like to know if there is a way to perform a selective data replication to another mongodb. I experimented with zone sharding, however, that does not look like an option that will work for us.

My use case is 2 sets of replicasets. They are located in different parts of the world. applications should only query the local db. headquarter_replicaset contains all data. division_replicaset should only contain a subset of data from headquarter_replicaset.

Zone sharding is not the right solution as data being sharded to division_replicaset are no longer available in headquarter_replicaset. mongo query from headquarters will be slow as it need to retrieve the sharded data from division_replicaset. Maybe I implemented zone sharding wrongly.

That is why I want to see if anyone out there implemented a way to selectively replicate data to remote nodes based on query results or through oplog filtering.

Any help is apprepriated.
Thanks, Eric

I would setup a change stream server that monitor only the databases/collections I want to be replicated from one replica set to the other.

I was going to suggest upvoting this idea on https://feedback.mongodb.com/forums/924280-database but to my surprise I couldn’t find this suggestion there! Which is strange because I know we’ve had other users ask for it…

Asya