Proper replica set connection

Dear MongoDB community,

Since I did not find a clear answe yet: Is connecting to the (formerly determined) primary member of a replica set with the “mongo” command line tool supported? It is also equivalent to using the full replica set connection string?

Best Regards,

Hi Friedolin,

Yes, one can connect to any of the members of a replica set direction or make a replicaset connection. The difference between the former and the latter is the inclusion of “replicaSet” query parameter and the list of members. Connecting directly, to a member, like the primary, would mean omitting the “replicaSet” query parameter and having only the host name of the target member in the connection URI.


1 Like

Thanks for you reply! When connected explicitly and only to the primary member of a replica set, will writes/changes be replicated in the same way like when connected using the full connection URI?

Yes, change applied to primary will be replicated regardless of the connection types discussed.