Mongo Replica Set with Several Secondaries in Separate Locations

I am running a MongoDB replica set with several secondaries. All secondaries have closer ping times to the Meteor instance than the primary. All MongoDB instances are in separate physical locations, some with <5ms ping times, some with 130ms times.

I have this when running my Meteor app
MONGO_URL=“mongodb://server1:27017,server2:27017,server3:27017/dbname?replicaSet=rs1&readPreference=nearest&w=majority”

Will this tell Meteor to write to the Primary and read from the CLOSEST Secondary based on ping times? server1 (furthest away) is the Primary. Server 2 and 3 are in separate places.

If the closest mongo Secondary goes down, will Meteor automatically start using the next mongo Secondary?

1 Like

This message is not very new, anyway I’ve got same issue.
I’m using as MONGO_URL:

mongodb://mongo-0.mongo:27017,mongo-1.mongo:27017,mongo-2.mongo:27017/mydb?replicaSet=rs0&readPreference=secondaryPreferred

but Meteor keeps querying only the primary (I can see it from mongo log: all my queries lands only on the primary).

Does anyone have any clue about this? It appears Meteor/mongo driver ignores the readPreference.

Hi i’m setting the MONGOURL in the forever service
export MONGO_URL=mongodb://10.xx.xx.xxx:27017,10.xx.xx.xxx:27017/Chat?replicaSet=rs1&readPreference=nearest
not working for me…help needed