title: ReactiveMongo 0.11.9 throws No primary node is available while connecting to mongodb 3.0.4
body: <p>I simply have a reactivemongo (version : <code>0.11.9</code>) insertion query as below, </p>
  
  <pre><code>class MongoInsertQuery extends Query {
    val DbName = "events-db"
    val CollectionName = "EventStream"
  
    val driver = new MongoDriver
    val connection = driver.connection(List("127.0.0.1:27018"))
  
      def insert() = {
          val db = connection(DbName)
          val collection: BSONCollection = db(CollectionName)
          val futureResult: Future[WriteResult] = collection.insert(BSONDocument("type" -&gt; "Product_Received"))
          futureResult onComplete {
            case Success(s) =&gt; println("Success " + s)
            case Failure(e) =&gt; {
              println("error " + e.getMessage)
              e.printStackTrace()
            }
          }
        }
  }
  </code></pre>
  
  <p>Not that important, but <em>Scala Play REST controller</em> would call that method </p>
  
  <pre><code>  def sayBeard = Action { request =&gt;
      new MongoInsertQuery().insert()
      Ok(Json.obj("message" -&gt; "TODO respond writeResult"))
    }
  </code></pre>
  
  <p>When I call the endpoint,</p>
  
  <pre><code>$ curl -XGET localhost:9000/sayBeard
  {"message":"TODO respond writeResult"}
  </code></pre>
  
  <p>It inserts successfully to <code>mongodb 2.4.14</code>, </p>
  
  <pre><code>precise64(mongod-2.4.14) events-db&gt; db.EventStream.find({})
  {
    "_id": ObjectId("5683337120906c127504eb79"),
    "type": "Product_Received"
  }
  </code></pre>
  
  <p>But I get <code>readAndDeserialize</code> error with <code>Failure</code> on <code>future onComplete</code>.</p>
  
  <pre><code>[info] - play.api.Play - Application started (Dev)
  error 83
  java.lang.ArrayIndexOutOfBoundsException: 83
      at org.jboss.netty.buffer.LittleEndianHeapChannelBuffer.getInt(LittleEndianHeapChannelBuffer.java:69)
      at reactivemongo.api.SerializationPack$class.readAndDeserialize(serializationpack.scala:31)
      at reactivemongo.api.BSONSerializationPack$.readAndDeserialize(serializationpack.scala:41)
      at reactivemongo.api.collections.GenericCollection$$anonfun$insert$1$$anonfun$apply$12.apply(genericcollection.scala:279)
      at reactivemongo.api.collections.GenericCollection$$anonfun$insert$1$$anonfun$apply$12.apply(genericcollection.scala:279)
      at scala.util.Success$$anonfun$map$1.apply(Try.scala:237)
      at scala.util.Try$.apply(Try.scala:192)
      at scala.util.Success.map(Try.scala:237)
      at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
      at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
      at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
      at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
      at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
      at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
      at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
      at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
  </code></pre>
  
  <p>My intention here is to read the <code>WriteResult</code> (<code>N</code>, <code>message</code>) on writeResult after inserting into Collection.</p>
  
  <p>With <code>mongo 3.0.6</code>, It couldn't even find mongodb.</p>
  
  <pre><code>23:02:02.172 [ForkJoinPool-6-worker-9] ERROR reactivemongo.api.Failover2 - Got an error, no more attempts to do. Completing with a failure...
  reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
      at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.&lt;clinit&gt;(actors.scala) ~[reactivemongo_2.11-0.11.9.jar:0.11.9]
      at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:681) ~[reactivemongo_2.11-0.11.9.jar:0.11.9]
      at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:681) ~[reactivemongo_2.11-0.11.9.jar:0.11.9]
      at scala.Option.getOrElse(Option.scala:121) ~[scala-library-2.11.7.jar:?]
      at reactivemongo.core.actors.MongoDBSystem$class.reactivemongo$core$actors$MongoDBSystem$$pickChannel(actors.scala:681) ~[reactivemongo_2.11-0.11.9.jar:0.11.9]
      at reactivemongo.core.actors.MongoDBSystem$$anonfun$4.applyOrElse(actors.scala:335) ~[reactivemongo_2.11-0.11.9.jar:0.11.9]
      at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170) ~[scala-library-2.11.7.jar:?]
      at akka.actor.Actor$class.aroundReceive(Actor.scala:467) ~[akka-actor_2.11-2.3.13.jar:?]
      at reactivemongo.core.actors.LegacyDBSystem.aroundReceive(actors.scala:796) ~[reactivemongo_2.11-0.11.9.jar:0.11.9]
      at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) ~[akka-actor_2.11-2.3.13.jar:?]
      at akka.actor.ActorCell.invoke(ActorCell.scala:487) ~[akka-actor_2.11-2.3.13.jar:?]
      at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) ~[akka-actor_2.11-2.3.13.jar:?]
      at akka.dispatch.Mailbox.run(Mailbox.scala:220) ~[akka-actor_2.11-2.3.13.jar:?]
      at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) ~[akka-actor_2.11-2.3.13.jar:?]
      at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.7.jar:?]
      at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.7.jar:?]
      at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.7.jar:?]
      at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.7.jar:?]
  </code></pre>
  
  <p>Though, I see connection log on mongo, </p>
  
  <pre><code>2015-12-30T23:21:57.688-0500 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51663 #11 (11 connections now open)
  </code></pre>
  
  <h2>Reference</h2>
  
  <p><a href="http://reactivemongo.org/releases/0.11/documentation/tutorial/write-documents.html" rel="nofollow">http://reactivemongo.org/releases/0.11/documentation/tutorial/write-documents.html</a></p>
  
  <p><a href="https://groups.google.com/forum/#!topic/reactivemongo/0jxS1cgXjP8" rel="nofollow">https://groups.google.com/forum/#!topic/reactivemongo/0jxS1cgXjP8</a></p>