title: How to connect to a MongoDB sharded cluster
body: <p>I setup a cluster on aws that looks like this</p>
  
  <pre><code>- mycluster
  --- shard0
  ----- node0 : P
  ----- node1 : S
  ----- node2 : S
  --- shard1
  ----- node0: P
  ----- node1: S
  ----- node2: S
  --- shard2
  ----- node0: P
  ----- node1: S
  ----- node2: S
  </code></pre>
  
  <p>I want to connect to it via a connection string URI.</p>
  
  <p>My connection string currently look like this:</p>
  
  <pre><code>mongodb://host0:portX,...,host9:portZ/test-database?replicaSet=mycluster
  </code></pre>
  
  <p>but for some reason I get the error <em>not reachable</em> when I attempt to connect with it.</p>
  
  <p>However, I can connect to a single shard just fine.</p>
  
  <pre><code>mongodb://host0:portX,...,host3:portZ/test-database?replicaSet=shard0
  </code></pre>
  
  <p>What am I missing here that is preventing me from connecting to the whole cluster?</p>