I have a mongodb replica set of 3 nodes, with the primary and one secondary located in the US, and another secondary in Western Europe. I'd like my nodejs application to read from whichever replica is nearest. I'm using the following connection URI to do this:
However, the application always ends up reading from the primary node in the set. Almost all of the queries are aggregations and I'm not doing any writes at all. All of the nodes in the replica are healthy and reachable according to rs.status().
I've also tried using readPreferences of 'secondary' and 'secondaryPreferred' but all have shown the same behaviour.
Am I missing something here?