MongoDB Nginx reverse proxy and replica set

Hello Team,
Can we use NGINX as a proxy to access ReplicasSet cluster ?

The goal is to implement the data residency is to use DB offloading approach.
DB offloading means storing the data in the related region data center and maintaining the
compute instances (services) in the central serving regions.
That means the services will be hosted in one region with DR capabilities and database will be
stored in multiple regions base on the client data residency requirement.
To enable this, we will separate our compute instances from our databases and add a reverse
proxy layer in front of the databases so the proxy that will manage to forward the request to the
related DB region based on the user’s associated region.
One area we have to ensure in this setup is to reduce the DB connection initiations and
maintain multiple queries under a single DB connection (Multiplexing), because the initialization
of DB connections will impact and increase the latency for DB responses across regions .

i don’t see any issues with this setup from a high level.

A reverse proxy is no different from a “ordinary client” from mongdb’s view point.

Honestly i don’t think you need to do this from your app logic. Mongodb drivers should already take care of that. You can check driver settings for connection pool related.

But one thing to note is mongodb is single primary replication, so all writes have to go the same instance, with probably cross-region calls.