<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Issue with MongoDB Spark Connector in Databricks in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/151819#M2539</link>
    <description>&lt;P&gt;try using single-user cluster or non-isolation cluster instead of shared cluster&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2026 12:57:56 GMT</pubDate>
    <dc:creator>NaveenBedadala</dc:creator>
    <dc:date>2026-03-24T12:57:56Z</dc:date>
    <item>
      <title>Issue with MongoDB Spark Connector in Databricks</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/107203#M1834</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the official Databricks documentation("&lt;A href="https://docs.databricks.com/en/_extras/notebooks/source/mongodb.html" target="_blank" rel="noopener"&gt;https://docs.databricks.com/en/_extras/notebooks/source/mongodb.html&lt;/A&gt;")&lt;/P&gt;&lt;P&gt;to integrate MongoDB Atlas with Spark by setting up the MongoDB Spark Connector and configuring the connection string in my Databricks cluster. However, I am encountering issues when trying to read data from MongoDB using Spark.&lt;/P&gt;&lt;P&gt;While I can successfully connect to MongoDB using the MongoClient in Python and execute queries like&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;from pymongo import MongoClient&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;client = MongoClient("connectionstring")&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;db = client["demo"]&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;collection = db["demo_collection"]&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;print(collection.find_one())&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;I am unable to load data using the Spark connector with the following code:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;df = spark.read.&lt;SPAN class=""&gt;format&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"mongodb"&lt;/SPAN&gt;) \ .option(&lt;SPAN class=""&gt;"database"&lt;/SPAN&gt;, database) \ .option(&lt;SPAN class=""&gt;"spark.mongodb.input.uri"&lt;/SPAN&gt;, connectionString) \ .option(&lt;SPAN class=""&gt;"collection"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"demo_collection"&lt;/SPAN&gt;) \ .load() df.printSchema()&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The connection string is the same in both cases, and I have confirmed that the necessary permissions and IP whitelisting are correctly configured in MongoDB Atlas.&lt;/P&gt;&lt;P&gt;Despite this, no data is being retrieved when using Spark, and I’m unable to identify the issue.&lt;/P&gt;&lt;P&gt;also, I attached error screenshot below.&lt;/P&gt;&lt;P&gt;Can anyone provide guidance on potential configuration issues or additional steps needed to troubleshoot this problem with the MongoDB Spark connector in Databricks?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 11:10:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/107203#M1834</guid>
      <dc:creator>vidya_kothavale</dc:creator>
      <dc:date>2025-01-27T11:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with MongoDB Spark Connector in Databricks</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/107218#M1835</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113924"&gt;@vidya_kothavale&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Could you try to change &lt;SPAN&gt;"spark.mongodb.input.uri" to following?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.read.format("mongodb").option("spark.mongodb.read.connection.uri"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 12:34:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/107218#M1835</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-01-27T12:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with MongoDB Spark Connector in Databricks</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/107240#M1836</link>
      <description>&lt;P&gt;Thanks! &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp; It's working perfectly now.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 13:38:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/107240#M1836</guid>
      <dc:creator>vidya_kothavale</dc:creator>
      <dc:date>2025-01-27T13:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with MongoDB Spark Connector in Databricks</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/111497#M1914</link>
      <description>&lt;P&gt;Hi vidya. I have the same problem.&lt;/P&gt;&lt;P&gt;I can connect using&amp;nbsp;pymongo&amp;nbsp; and compass . I installed the library&amp;nbsp;org.mongodb.spark:mongo-spark-connector_2.13:10.4.1 (latest one) on my cluster using the runtime 16.2 but I never was able to connect to same mongo cluster (sharded) using the primary as default.&lt;/P&gt;&lt;P&gt;This is the scala code (I've tested in python as well)&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;val&lt;/SPAN&gt; &lt;SPAN&gt;connstr&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"mongodb://user:xxxxxxx@cluster/dbxxx?tls=true&amp;amp;tlsInsecure=true&amp;amp;authSource=admin"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;val&lt;/SPAN&gt; &lt;SPAN&gt;df&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; spark.read.format(&lt;/SPAN&gt;&lt;SPAN&gt;"mongodb"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"database"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"dbdbdbdbdb"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"spark.mongodb.read.connection.uri"&lt;/SPAN&gt;&lt;SPAN&gt;, connstr)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"collection"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"cccccccccc"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.load().limit(&lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Also I can telnet the cluster successfully .&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any clues?&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 01 Mar 2025 13:46:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/111497#M1914</guid>
      <dc:creator>RobsonNLPT</dc:creator>
      <dc:date>2025-03-01T13:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with MongoDB Spark Connector in Databricks</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/132018#M2241</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113924"&gt;@vidya_kothavale&lt;/a&gt;&amp;nbsp; facing similar issue not sure how to resolve..&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;cluster runtime :&amp;nbsp;16.4 LTS (includes Apache Spark 3.5.2, Scala 2.12)&lt;BR /&gt;mongodb spark connector :&amp;nbsp;&lt;A target="_blank"&gt;org.mongodb.spark:mongo-spark-connector_2.12:10.5.0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;code:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; (spark.read&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"mongodb"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;option&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"spark.mongodb.read.connection.uri"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"mongodb+srv://nucleus-auth-prd:&amp;lt;mypassword&amp;gt;@prd-default-pl-1.gzopt.mongodb.net/nucleus-auth-prd-default?authSource=admin&amp;amp;readPreference=secondary"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;option&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"database"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"nucleus-auth-prd-default"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;option&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"collection"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"userEntities"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;load&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;Error:&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;(com.mongodb.MongoSecurityException) Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='nucleus-auth-prd', source='admin', password=&amp;lt;hidden&amp;gt;, mechanismProperties=&amp;lt;hidden&amp;gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Can you help what could be the missing piece for me ?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 16:03:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/132018#M2241</guid>
      <dc:creator>prateekmanocha</dc:creator>
      <dc:date>2025-09-15T16:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with MongoDB Spark Connector in Databricks</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/151819#M2539</link>
      <description>&lt;P&gt;try using single-user cluster or non-isolation cluster instead of shared cluster&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2026 12:57:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/issue-with-mongodb-spark-connector-in-databricks/m-p/151819#M2539</guid>
      <dc:creator>NaveenBedadala</dc:creator>
      <dc:date>2026-03-24T12:57:56Z</dc:date>
    </item>
  </channel>
</rss>

