The connection string for connecting to the replica set can contain the address of either all the nodes or just one node along with the name of the replica set and the port number on which the mongod instances are running.
This works because when you create a replica set and add nodes to it, the configuration of the entire replica set is shared with each specific node in the set and hence they are aware of each others existence. This way each node stores the entire topology of the replica set.
Additionally, you might find this thread helpful.
However, if you still have any question which is unanswered, please feel free to reach out to us.
Curriculum Support Engineer