Write to N Replica Sets

I’m looking for insights on how I can enable my applications to dual write, or triple write, or N write, to a various number of Replica Sets for migration purposes.

It seems most migration strategies involve mirroring data from one Replica Set to another, then blocking updates, to let the data synchronize for a brief period of time, and then swap the applications to the new replica set.

A preferable approach would be to have my application keep two data sets (or n data sets) in sync via dual writing. This way I can prove my application write performance before migrating. I can also gradually migrate my synchronous read requests.

Does anyone have client implementation ideas or examples where they have done this?

Going through the nodejs driver has been confusing for me, and it’s been difficult to identify what concept I can wrap to enable dual writing.

For example

clientBlue = new MongodbClient()
clientGreen = new MongodbClient()
multiWriteClient = new MultiClient(clientBlue, clientGreen)

conn = mongoose.connection()
conn.setClient(multiWriteClient)

Wrapping the client isn’t the right layer from what I can see as most of the interactions happen at the db which is part of the client. And then in a mildly confusing twist, the db then references the client.

Thanks for the consideration.