<?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 mongodb spark in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/mongodb-spark/m-p/132439#M49484</link>
    <description>&lt;P&gt;Hello Guys,&lt;BR /&gt;&lt;BR /&gt;Someone know a technique to perform write for a delta table to Mongo using connection mongodb&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;I have 1 bilion records to write&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Sep 2025 13:24:27 GMT</pubDate>
    <dc:creator>seefoods</dc:creator>
    <dc:date>2025-09-18T13:24:27Z</dc:date>
    <item>
      <title>mongodb spark</title>
      <link>https://community.databricks.com/t5/data-engineering/mongodb-spark/m-p/132439#M49484</link>
      <description>&lt;P&gt;Hello Guys,&lt;BR /&gt;&lt;BR /&gt;Someone know a technique to perform write for a delta table to Mongo using connection mongodb&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;I have 1 bilion records to write&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 13:24:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongodb-spark/m-p/132439#M49484</guid>
      <dc:creator>seefoods</dc:creator>
      <dc:date>2025-09-18T13:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: mongodb spark</title>
      <link>https://community.databricks.com/t5/data-engineering/mongodb-spark/m-p/132444#M49487</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65591"&gt;@seefoods&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yes, it's well described at mongo db connector documentation page.&amp;nbsp;To write data to MongoDB you need call the write function on your DataFrame object. This function returns a DataFrameWriter object, which you can use to specify the format and other configuration settings for your batch write operation.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here's an example of how to use it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dataFrame = spark.createDataFrame([("Bilbo Baggins",  50), ("Gandalf", 1000), ("Thorin", 195), ("Balin", 178), ("Kili", 77),
   ("Dwalin", 169), ("Oin", 167), ("Gloin", 158), ("Fili", 82), ("Bombur", None)], ["name", "age"])

dataFrame.write.format("mongodb")
               .mode("append")
               .option("database", "people")
               .option("collection", "contacts")
               .save()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing to notice here -&amp;nbsp;MongoDB Spark Connector &lt;STRONG&gt;supports the following save modes:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;append&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;overwrite&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;So, in your case just read delta table to Dataframe and use DataFrameWriter object as described above.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-write/" target="_blank" rel="noopener"&gt;Write to MongoDB in Batch Mode - Spark Connector - MongoDB Docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: This connector also support streaming mode. So this is something you also can consider if you want an easy way to load data incrementally from Delta Table to Mongo&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mongodb.com/docs/spark-connector/current/streaming-mode/" target="_blank" rel="noopener"&gt;Streaming Mode - Spark Connector - MongoDB Docs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 13:37:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongodb-spark/m-p/132444#M49487</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-09-18T13:37:21Z</dc:date>
    </item>
  </channel>
</rss>

