title: Is the ReplicaSet name necessary in MongoClientURI Connection String?
body: <p>I am confused about the <strong>use/need</strong> of the MongoDB connection string <a href="https://docs.mongodb.com/manual/reference/connection-string/#replica-set-option" rel="nofollow">replicaSet</a> option, when specifying a client URI for connection to a MongoDB replica set from a Java application.</p>
  
  <p>I have 3 node instances of MongoDB running comprising the replica set, and each is specified as being a member of the same replica set.  I would like to connect to the replica set from my Java application.  I am confused from the documentation I have read, if it is even necessary to specify the replica set name in the connection string when I give a list of more than 2 hostnames.</p>
  
  <p>Here is how I start my 3 node MongoDB instances.</p>
  
  <ol>
  <li>Server1$: mongod --replSet "<strong>rs0</strong>"</li>
  <li>Server2$: mongod --replSet "<strong>rs0</strong>"</li>
  <li>Server3$: mongod --replSet "<strong>rs0</strong>"</li>
  </ol>
  
  <p>I assume a negotiation then occurs, and a Primary is elected, and the remaining
  are marked as Secondaries.</p>
  
  <p>I would then want to connect to the replica set via the MongoClient call from my Java application. Is the actual replica set name even needed?  And do I need to list each member of the replica set, or does the MongoDB driver only need a single member of the replica set to determine the rest?</p>
  
  <pre class="lang-java prettyprint-override"><code>MongoClient mongoClient = new MongoClient(
    new MongoClientURI(
      "mongodb://Server1,Server2,Server3/?replicaSet=rs0"
    )
  );
  </code></pre>
  
  <p><strong>Do I need the replicaSet option?</strong></p>