title: Mongo Spark connector, auth error
body: <p>I'm trying to connect to my local MongoDB from Spark.<br>
  I've read few topics about it, but none of them works. What is wrong with my setup ?  </p>
  
  <pre><code>  val spark = SparkSession.builder()
      .master("local")
      .appName("MongoSparkConnectorIntro")
      .config("spark.mongodb.input.uri", "mongodb://user:pass@localhost:27017/dbName.collectionName")
      .getOrCreate()
  
    it should "connect" in {
      val rdd = MongoSpark.load(spark)
      println(rdd.count())
    }
  </code></pre>
  
  <p><strong>Auth setup :</strong>  </p>
  
  <pre><code>mongo dbName --eval "db.createUser({ user: 'user', pwd: 'pass', roles: [ { role: '-dbOwner', db: 'dbName' } ] });"
  </code></pre>
  
  <p><strong>Error :</strong></p>
  
  <pre><code>14:13:04.538 [ScalaTest-run-running-MongoConnector] DEBUG org.mongodb.driver.cluster - Updating cluster description to  {type=UNKNOWN, servers=[{address=127.0.0.1:27017, type=UNKNOWN, state=CONNECTING}]
  14:13:04.540 [ScalaTest-run-running-MongoConnector] INFO  org.mongodb.driver.cluster - Cluster description not yet available. Waiting for 30000 ms before timing out
  14:13:04.563 [cluster-ClusterId{value='59f5d3e0ee179e015809a115', description='null'}-127.0.0.1:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:1}
  14:13:04.564 [cluster-ClusterId{value='59f5d3e0ee179e015809a115', description='null'}-127.0.0.1:27017] INFO  org.mongodb.driver.cluster - Exception in monitor thread while connecting to server 127.0.0.1:27017
  com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='user', source='dbName', password=&lt;hidden&gt;, mechanismProperties={}}
  (...)
  Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server 127.0.0.1:27017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }
      at com.mongodb.connection.CommandHelper.createCommandFailureException(CommandHelper.java:170)
      at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:123)
      at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)
      at com.mongodb.connection.SaslAuthenticator.sendSaslStart(SaslAuthenticator.java:117)
  14:17:28.944 [cluster-ClusterId{value='59f5d4e8ee179e027923cfdf', description='null'}-127.0.0.1:27017] DEBUG org.mongodb.driver.cluster - Updating cluster description to  {type=UNKNOWN, servers=[{address=127.0.0.1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='user', source='dbName', password=&lt;hidden&gt;, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server 127.0.0.1:27017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }}}]
  14:17:29.451 [cluster-ClusterId{value='59f5d4e8ee179e027923cfdf', description='null'}-127.0.0.1:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:2}
  </code></pre>
  
  <p><strong>Versions:</strong><br>
  1. Spark 2.2.0<br>
  2. Mongo 3.4<br>
  3. Mongo-spark-connector_2.11, version: 2.2.0<br>
  4. Scala 2.11.8  </p>
  
  <p><strong>EDIT:</strong><br>
  I;ve tried to add to </p>
  
  <pre><code>.config("spark.mongodb.input.uri", "mongodb://user:pass@localhost:27017/dbName.collectionName")
  </code></pre>
  
  <p>flags:  </p>
  
  <ul>
  <li>?authSource=admin   </li>
  <li>?authSource=dbOwner   </li>
  <li>?authSource=dbName  </li>
  <li>?authenticationDatabase=dbName</li>
  </ul>
  
  <p>but none of them works</p>