<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SSIS MongoDB ExecuteSQL Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/tasks/ssis-mongodb-executesql-task/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/tasks/ssis-mongodb-executesql-task/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Mon, 02 Mar 2026 16:07:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>SSIS MongoDB ExecuteSQL Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/tasks/ssis-mongodb-executesql-task/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>SSIS tutorial: How to load MariaDB data into MongoDB</title>
		<link>https://zappysys.com/blog/how-to-load-mariadb-data-into-mongodb/</link>
		
		<dc:creator><![CDATA[ZappySys Team]]></dc:creator>
		<pubDate>Fri, 27 Feb 2026 12:20:05 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=11787</guid>

					<description><![CDATA[<p>Introduction In our previous post, we explored how to read and write MongoDB data using the ZappySys MongoDB Source and Destination SSIS connectors. In this article, you will learn how to connect MariaDB to MongoDB using ZappySys SSIS PowerPack and transfer data between both systems. We will demonstrate a practical ETL pattern using ZappySys ODBC/JDBC connectivity to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-load-mariadb-data-into-mongodb/">SSIS tutorial: How to load MariaDB data into MongoDB</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" />In our previous post, we explored how to read and write MongoDB data using the <a href="https://zappysys.com/products/ssis-powerpack/ssis-mongodb-source/" target="_blank" rel="noopener">ZappySys MongoDB Source</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/" target="_blank" rel="noopener">Destination</a> SSIS connectors. In this article, you will learn how to connect MariaDB to MongoDB using ZappySys SSIS PowerPack and transfer data between both systems.</p>
<p>We will demonstrate a practical ETL pattern using ZappySys ODBC/JDBC connectivity to extract data from MariaDB and load it into MongoDB within SSIS.</p>
<h2>Prerequisites</h2>
<p>Before you begin, make sure you have the following:</p>
<ul>
<li>First, you will need to have SSIS installed</li>
<li>Secondly, make sure to have SSDT</li>
<li>Thirdly, access credentials for both MariaDB and MongoDB</li>
<li>Finally, do not forget to install ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> and ZappySys <a href="https://zappysys.com/products/ODBC-powerpack/" target="_blank" rel="noopener">ODBC PowerPack</a></li>
</ul>
<h2>Steps</h2>
<h3>Configure MariaDB Connection Using ODBC (JDBC Bridge)</h3>
<p>Since MariaDB connectivity is handled via JDBC, we will use the <strong>ZappySys JDBC Bridge Driver</strong> to expose it as an ODBC data source.</p>
<ol>
<li>Visit the <a href="https://mariadb.com/downloads/connectors/connectors-data-access/java8-connector">official MariaDB website</a>.</li>
<li>Download the latest <strong>MariaDB JDBC driver</strong>.</li>
<li>Save the <code inline="">.jar</code> file locally, for example: <span style="background-color: #f2f4f5; color: #222222; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 12.8px;">D:\Zappysys\drivers\mariadb-java-client-3.5.7.jar</span></li>
<li>Download and install <a href="https://zappysys.com/products/odbc-powerpack/download/"><strong>ZappySys ODBC PowerPack</strong></a> if not already installed.</li>
<li>Open <strong>ODBC Data Sources (64-bit)</strong>.
<div id="attachment_6213" style="width: 404px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-6213" class="wp-image-6213 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2.png" alt="" width="394" height="542" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2.png 394w, https://zappysys.com/blog/wp-content/uploads/2019/01/how-to-open-odbc-data-source-administrator-2-218x300.png 218w" sizes="(max-width: 394px) 100vw, 394px" /></a><p id="caption-attachment-6213" class="wp-caption-text">Open ODBC Data Sources</p></div></li>
<li>Create a <strong>User data source</strong> (User DSN) based on <strong>ZappySys JDBC Bridge Driver</strong>:
<div id="attachment_11767" style="width: 632px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Create-a-User-data-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11767" class="size-full wp-image-11767" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Create-a-User-data-source.png" alt="" width="622" height="517" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Create-a-User-data-source.png 622w, https://zappysys.com/blog/wp-content/uploads/2026/02/Create-a-User-data-source-300x249.png 300w" sizes="(max-width: 622px) 100vw, 622px" /></a><p id="caption-attachment-11767" class="wp-caption-text">Create a User data source</p></div></li>
<li>Configure the JDBC Connection. Fill in the connection details
<ul style="list-style-type: disc;">
<li><strong>Connection String  </strong><code>jdbc:mariadb://{host-name}:{port}/{database-name}<br />
</code></li>
<li><strong>JDBC Driver File </strong><code>D:\Zappysys\drivers\mariadb-java-client-3.5.7.jar<br />
</code></li>
<li><strong>Username </strong><code>root<br />
</code></li>
<li><strong>Password </strong><code>********<br />
</code></li>
<li><strong>Connection Parameters</strong><code>[]</code></li>
</ul>
</li>
<li>Click <strong>Test Connection</strong>. If configured correctly, you should see a success message.
<div class="mceTemp"></div>
<div id="attachment_11768" style="width: 814px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-Mariadb.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11768" class="size-full wp-image-11768" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-Mariadb.png" alt="" width="804" height="704" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-Mariadb.png 804w, https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-Mariadb-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-Mariadb-768x672.png 768w" sizes="(max-width: 804px) 100vw, 804px" /></a><p id="caption-attachment-11768" class="wp-caption-text">Zappysys JDBC &#8211; MariaDB</p></div></li>
<li>You can also use the <strong>Preview</strong> tab to select the table and execute SQL queries. For advanced SQL examples, refer to the <a href="https://zappysys.com/onlinehelp/odbc-powerpack/index.htm#page=jdbc-odbc-driver-sql-query-examples.htm" target="_blank" rel="noopener">JDBC Bridge documentation</a>.
<div id="attachment_11769" style="width: 814px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-MariaDB-preview-result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11769" class="size-full wp-image-11769" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-MariaDB-preview-result.png" alt="" width="804" height="704" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-MariaDB-preview-result.png 804w, https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-MariaDB-preview-result-300x263.png 300w, https://zappysys.com/blog/wp-content/uploads/2026/02/Zappysys-JDBC-MariaDB-preview-result-768x672.png 768w" sizes="(max-width: 804px) 100vw, 804px" /></a><p id="caption-attachment-11769" class="wp-caption-text">Zappysys JDBC &#8211; MariaDB preview result</p></div></li>
</ol>
<h3>Connect MariaDB to SSIS</h3>
<ol>
<li>Open <strong>Visual Studio</strong>.</li>
<li>Create a <strong>New Project</strong>.</li>
<li>Select <strong>Integration Services Project</strong>.</li>
<li>Provide a project name and location, then click <strong>OK</strong>.</li>
<li>Drag and drop a <strong>Data Flow Task</strong> from the SSIS Toolbox onto the Control Flow surface.
<div id="attachment_11784" style="width: 485px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11784" class="size-full wp-image-11784" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png" alt="" width="475" height="178" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow.png 475w, https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-Data-flow-300x112.png 300w" sizes="(max-width: 475px) 100vw, 475px" /></a><p id="caption-attachment-11784" class="wp-caption-text">Drag and drop Data flow.</p></div></li>
<li>Double-click the task to open the <strong>Data Flow Designer</strong>.</li>
<li>Drag and drop an <strong>ODBC Source</strong> component into the Data Flow.
<div id="attachment_11783" style="width: 489px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-ODBC-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11783" class="size-full wp-image-11783" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-ODBC-source.png" alt="" width="479" height="227" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-ODBC-source.png 479w, https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-ODBC-source-300x142.png 300w" sizes="(max-width: 479px) 100vw, 479px" /></a><p id="caption-attachment-11783" class="wp-caption-text">Drag and drop the ODBC source.</p></div></li>
<li>Double-click the component to configure it.</li>
<li>Click <strong>New…</strong> to create a new ODBC Connection Manager.
<div id="attachment_11772" style="width: 763px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11772" class="size-full wp-image-11772" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS.png" alt="" width="753" height="685" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS.png 753w, https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS-300x273.png 300w" sizes="(max-width: 753px) 100vw, 753px" /></a><p id="caption-attachment-11772" class="wp-caption-text">Creating an ODBC Connection Manager in SSIS</p></div></li>
<li>Select the MariaDB ODBC DSN you created earlier.</li>
<li>Click <strong>Test Connection </strong>and click <strong>OK </strong>to save the configuration.
<div id="attachment_11773" style="width: 724px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS-from-JDBC.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11773" class="size-full wp-image-11773" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS-from-JDBC.png" alt="" width="714" height="620" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS-from-JDBC.png 714w, https://zappysys.com/blog/wp-content/uploads/2026/02/Creating-ODBC-Connection-Manager-in-SSIS-from-JDBC-300x261.png 300w" sizes="(max-width: 714px) 100vw, 714px" /></a><p id="caption-attachment-11773" class="wp-caption-text">Creating an ODBC Connection Manager in SSIS from JDBC</p></div></li>
<li>Choose <strong>Data Access Mode: </strong>Table name or SQL command.</li>
<li>Select the desired table or enter a custom query.</li>
<li><span style="box-sizing: border-box; margin: 0px; padding: 0px;">Click <strong>Preview</strong> to validate the data, and click <strong>OK </strong>to save the configuration.<br />
</span></p>
<div id="attachment_11774" style="width: 763px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Preview-ODBC-Connection-Manager-in-SSIS-from-JDBC.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11774" class="size-full wp-image-11774" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Preview-ODBC-Connection-Manager-in-SSIS-from-JDBC.png" alt="" width="753" height="637" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Preview-ODBC-Connection-Manager-in-SSIS-from-JDBC.png 753w, https://zappysys.com/blog/wp-content/uploads/2026/02/Preview-ODBC-Connection-Manager-in-SSIS-from-JDBC-300x254.png 300w" sizes="(max-width: 753px) 100vw, 753px" /></a><p id="caption-attachment-11774" class="wp-caption-text">Preview an ODBC Connection Manager in SSIS from JDBC</p></div></li>
</ol>
<h3>Configure MongoDB Destination</h3>
<ol>
<li>In the Connection Manager pane, click <strong>New Connection</strong>.</li>
<li>Select <strong>ZS-MONGODB</strong>.</li>
<li>Configure the connection:
<ul style="list-style-type: disc;">
<li>Host</li>
<li>Username</li>
<li>Password</li>
<li>Database</li>
</ul>
</li>
<li>Use the other tabs for more configuration if needed</li>
<li>Click <strong>Test Connection </strong>and Click <strong>OK</strong>.
<div id="attachment_11793" style="width: 628px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-connection-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11793" class="size-full wp-image-11793" src="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-connection-configuration.png" alt="" width="618" height="580" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-connection-configuration.png 618w, https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-connection-configuration-300x282.png 300w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-11793" class="wp-caption-text">MongoDB connection configuration</p></div></li>
<li>Drag and drop the <a href="https://zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/"><strong>MongoDB Destination</strong></a> component.
<div id="attachment_11792" style="width: 504px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-MongoDB-destination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11792" class="size-full wp-image-11792" src="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-MongoDB-destination.png" alt="" width="494" height="248" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-MongoDB-destination.png 494w, https://zappysys.com/blog/wp-content/uploads/2026/02/Drag-and-drop-MongoDB-destination-300x151.png 300w" sizes="(max-width: 494px) 100vw, 494px" /></a><p id="caption-attachment-11792" class="wp-caption-text">Drag and drop the MongoDB destination</p></div></li>
<li>Connect it to the <strong>ODBC Source </strong>and double-click to configure it.</li>
<li>Select the MongoDB connection.
<div id="attachment_11797" style="width: 733px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Select-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11797" class="size-full wp-image-11797" src="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Select-connection.png" alt="" width="723" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Select-connection.png 723w, https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Select-connection-300x155.png 300w" sizes="(max-width: 723px) 100vw, 723px" /></a><p id="caption-attachment-11797" class="wp-caption-text">MongoDB Destination &#8211; Select connection</p></div></li>
<li>Go to the <strong>Properties</strong> tab and choose the operation and the target table.
<div id="attachment_11796" style="width: 733px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Properties-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11796" class="size-full wp-image-11796" src="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Properties-configuration.png" alt="" width="723" height="664" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Properties-configuration.png 723w, https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Properties-configuration-300x276.png 300w" sizes="(max-width: 723px) 100vw, 723px" /></a><p id="caption-attachment-11796" class="wp-caption-text">MongoDB Destination &#8211; Properties configuration</p></div></li>
<li>Go to the <strong>Column Mappings</strong> tab and map source columns to destination columns.
<div id="attachment_11795" style="width: 733px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Map-the-columns.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11795" class="size-full wp-image-11795" src="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Map-the-columns.png" alt="" width="723" height="664" srcset="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Map-the-columns.png 723w, https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Map-the-columns-300x276.png 300w" sizes="(max-width: 723px) 100vw, 723px" /></a><p id="caption-attachment-11795" class="wp-caption-text">MongoDB Destination &#8211; Map the columns.</p></div></li>
<li>Click <strong>OK </strong>to save the configuration.</li>
<li>Run the SSIS package. If everything is configured correctly, the data will be transferred from MariaDB to MongoDB.
<div id="attachment_11794" style="width: 269px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Final-Result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11794" class="size-full wp-image-11794" src="https://zappysys.com/blog/wp-content/uploads/2026/02/MongoDB-Destination-Final-Result.png" alt="" width="259" height="270" /></a><p id="caption-attachment-11794" class="wp-caption-text">MongoDB Destination &#8211; Final Result</p></div></li>
</ol>
<h2>Conclusion</h2>
<p>With ZappySys SSIS PowerPack and ODBC PowerPack, connecting MariaDB to MongoDB becomes straightforward and reliable.</p>
<p>By configuring the ODBC/JDBC bridge for MariaDB and using the native MongoDB destination in SSIS, you can build a robust ETL pipeline between the two databases.</p>
<p>Explore the full capabilities of the ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> and ZappySys <a href="https://zappysys.com/products/ODBC-powerpack/" target="_blank" rel="noopener">ODBC PowerPack</a> to optimize your data integration tasks.</p>
<h1>Need Help?</h1>
<p>If you encounter any issues, our support team is here to help:</p>
<ul>
<li><strong>Live Chat</strong> — Use the chat widget (bottom-right corner of this page)</li>
<li><strong>Email</strong> — <a href="mailto:support@zappysys.com">support@zappysys.com</a></li>
<li><strong>Support Center</strong> — Support | ZappySys</li>
</ul>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/how-to-load-mariadb-data-into-mongodb/">SSIS tutorial: How to load MariaDB data into MongoDB</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Update MongoDB Array Items using SSIS</title>
		<link>https://zappysys.com/blog/update-mongodb-array-items-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 21 Jan 2017 23:00:55 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB Destination]]></category>
		<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<category><![CDATA[SSIS Template Transform]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[upsert]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=952</guid>

					<description><![CDATA[<p>Introduction In our previous blog post we saw how to perform Read and Write operations in MongoDB using SSIS (i.e. Bulk Update, Delete, Upsert, Insert). In this post we specifically focus on how to update MongoDB Array items / elements using SSIS. To make things simple to follow we have used JSON Source to produce [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/">Update MongoDB Array Items using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png"><img loading="lazy" decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" /></a>In <a href="https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/" target="_blank" rel="noopener">our previous blog post</a> we saw how to perform Read and Write operations in MongoDB using SSIS (i.e. Bulk Update, Delete, Upsert, Insert). In this post we specifically focus on <em>how to update MongoDB Array items / elements using SSIS</em>.</p>
<p>To make things simple to follow we have used <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> to produce sample JSON documents for MongoDB update (NOTE: Output as Document option is checked for JSON Source). However in real world you may have to use <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">SSIS JSON Generator Transform</a> to produce input documents for MongoDB. To learn more about generating JSON documents for MongoDB Load process <a href="//zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/" target="_blank" rel="noopener">check this blog post</a> or watch video found <a href="//zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">on this page</a>.</p>
<h2>Video Tutorial &#8211; Example of insert/update documents inside MongoDB Array (Use $set, $push operator)</h2>
<a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FcaiLHfF-pzg%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Basic Concepts: Performing MongoDB CRUD operations using SSIS</h2>
<p>If you never heard term called CRUD stands for Create, Read, Update, Delete. These are the most common operations you have to do with any data source. <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> comes with many MongoDB Components to help you with CRUD operations. You can use one or more following components to achieve drag and drop MongoDB CRUD operations in SSIS. When you use SSIS PowerPack for MongoDB all operations will be Bulk Operations by default which means it will provide very high throughput.</p>
<ul>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-source/" target="_blank" rel="noopener">SSIS MongoDB Source</a></li>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-destination/" target="_blank" rel="noopener">SSIS MongoDB Destination</a></li>
<li><a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">SSIS MongoDB ExecuteSQL Task</a></li>
</ul>
<h2>Download Example SSIS Package</h2>
<p>Here is the link to <a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-array-update-sample-package.zip">download Sample SSIS Package</a></p>
<div id="attachment_958" style="width: 711px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-958" class="size-full wp-image-958" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull.png" alt="SSIS Example : Update MongoDB Array Items / Elements (Update, Delete, Insert - Using $set, $pull, $push)" width="701" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull.png 701w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-update-mongodb-array-items-delete-insert-set-push-pull-300x208.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-958" class="wp-caption-text">SSIS Example : Update MongoDB Array Items / Elements (Update, Delete, Insert &#8211; Using $set, $pull, $push)</p></div>
<p>&nbsp;</p>
<h2>Update MongoDB Array Items ($set operator)</h2>
<p>In next couple of sections we will see how to perform Update, Insert and Delete operations with MongoDB Array Items using various <a href="https://docs.mongodb.com/manual/reference/operator/update/" target="_blank" rel="noopener">update operators</a> and <a href="https://docs.mongodb.com/manual/reference/operator/update-array/" target="_blank" rel="noopener">array operators</a>. Consider the following Sample JSON documents for MongoDB. First we will see how to use MongoDB Shell commands to perform CRUD operations on MongoDB Array items.</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("5883ebe669e0f22ba890b49b"),
    "CustomerID" : "BOLID",
    "Name" : "Some name",
    "Orders" : [ 
        {
            "OrderID" : 200,
            "ShipCountry" : "USA",
            "City" : "Atlanta"
        }, 
        {
            "OrderID" : 201,
            "ShipCountry" : "USA",
            "City" : "New York"
        }
    ]
}</pre><p>
<h3>Update Array element using Shell command</h3>
<p>Assume you want to update ShipCountry attribute of one of the Orders (OrderID=200) and for CustomerID=&#8221;BOLID&#8221; in above sample document.</p>
<h4>Shell Command for Update Array Item</h4>
<p>Use below shell command in your favorite MongoDB Client Tool (e.g. RoboMongo). Notice two things in below command because we will apply same concepts when we take this approach to SSIS. In below command Actual JSON document is wrapped inside. This is MongoDB Update operator. <a href="https://docs.mongodb.com/manual/reference/operator/update/set/" target="_blank" rel="noopener">Click here to learn more about $set</a>. Also notice that rather than nested Array syntax we used Orders.$.ShipCountry to update ShipCountry which is part of Array element. MongoDB provides special way to navigate array elements using   <a href="https://docs.mongodb.com/manual/reference/operator/update/positional/" target="_blank" rel="noopener">$ Operator (MongoDB Positional Update) </a></p><pre class="crayon-plain-tag">db.MyCollection.update(
	{ "CustomerID" : "BOLID", "Orders.OrderID" : 200 }, 
	{ $set : { "Orders.$.ShipCountry" : "Test1"} } , 
	{ upsert: false, multi: false}
)</pre><p>
<h4>After Update (MongoDB Document)</h4>
<p>After you run above shell command notice all other attributes remain there in Array document and only ShipCountry is changed. This is because we used <a href="https://docs.mongodb.com/manual/reference/operator/update/positional/" target="_blank" rel="noopener">$ Operator (MongoDB Positional Update) </a>rather than supplying Raw JSON for Array document (i.e. Orders : [ { &#8230; } ] ).</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("5883ebe669e0f22ba890b49b"),
    "CustomerID" : "BOLID",
    "Name" : "Some name",
    "Orders" : [ 
        {
            "OrderID" : 200,
            "ShipCountry" : "Test1",
            "City" : "Atlanta"
        }, 
        {
            "OrderID" : 201,
            "ShipCountry" : "USA",
            "City" : "New York"
        }
    ]
}</pre><p>
The issue with this approach its not Bulk operation. Assume that you have 100,000 records to update in various documents and its nested array items then row by row operation is not effective. To solve this issue we will use SSIS MongoDB Destination which performs Bulk operations (e.g. Bulk Update, Delete, Insert and Upsert).</p>
<h3>Update MongoDB Array Items using SSIS</h3>
<p>Now lets implement above scenario using SSIS. Assume that you have sample MongoDB document (as per above example &#8211; Before Update). We want to update ShipCountry for OrderID=200 for Customer BOLID. To do that perform following steps in SSIS. If you are updating Second level array (i.e. Root &gt;&gt; Orders &gt;&gt; OrderItems)  then you have follow slight different process. Check next section in this article about updating second level array (Insert items)</p>
<ol>
<li>Download and <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Install SSIS PowerPack</a></li>
<li>Create new SSIS Project with one data flow task
<div id="attachment_8028" style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Drag ZS JSON Source and check Output as Document option (as below sceenshot). You can use JSON Source is your JSON is stored inside file or Variable or coming from Some API call which eventually go into MongoDB. You can also use JSON Source for quick testing where you Hardcode JSON to feed to MongoDB.</li>
<li>Enter the following JSON in the text area. Click OK to save.<br />
<pre class="crayon-plain-tag">{"CustomerID":"BOLID", "Orders.$.OrderID":201, "Orders.$.ShipCountry": "Test1"}
{"CustomerID":"BOLID", "Orders.$.OrderID":202, "Orders.$.ShipCountry": "Test2"}
/**Below is extra record not found in destination - will be ignored in Update**/
{"CustomerID":"BOLID", "Orders.$.OrderID":203, "Orders.$.ShipCountry": "Test3"}</pre>
</li>
<li>Right click in Connections area and Create new ZS-MONGODB connection. Specify credentials and click Test before you hit OK to save.</li>
<li>Now drag ZS MongoDB Destination from SSIS Toolbox.</li>
<li>Select Runtime connection.</li>
<li>On the properties tab edit following properties
<ol>
<li>Set ColumnsForLookup property as below (Notice how we use 2 columns for JOIN. Also used AS keywords for 2nd Column so we have <em>&lt;column-from-input-doc&gt; AS &lt;column-for-server-side-find&gt;</em><br />
<strong><em>CustomerID,Orders.$.OrderID AS Orders.OrderID</em></strong></li>
<li>Set LoadOptions as below (Op is <a href="https://docs.mongodb.com/manual/reference/operator/update" target="_blank" rel="noopener">Update Operator</a> you like to use. In our case its <a href="https://docs.mongodb.com/manual/reference/operator/update/set/" target="_blank" rel="noopener">$set</a>, Multi=True means if multiple match found then all matching documents will be updated). If you want to use multiple update operators then you have to supply that from Input document and use <strong>op=none</strong> option rather <strong>op=$set</strong>.<br />
<strong><em>op=$set;multi=true</em></strong></li>
<li>Set Operation property to Update</li>
</ol>
</li>
<li>On the Mappings tab Map __DOCUMENT__ from upstream (In our case you will see same name column from JSON Source if you checked Output as Document option)</li>
<li>Click OK to save MongoDB Destination UI</li>
<li>Run package. You will notice after execution two orders of CustomerID=BOLID will be updated.</li>
</ol>
<div id="attachment_961" style="width: 853px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-961" class="size-full wp-image-961" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents.png" alt="SSIS JSON Source - Read JSON (Raw Documents)" width="843" height="507" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents.png 843w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-read-raw-json-documents-300x180.png 300w" sizes="(max-width: 843px) 100vw, 843px" /></a><p id="caption-attachment-961" class="wp-caption-text">SSIS JSON Source &#8211; Read JSON (Raw Documents)</p></div>
<h2></h2>
<div id="attachment_962" style="width: 749px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-962" class="size-full wp-image-962" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator.png" alt="SSIS MongoDB Destination - Update MongoDB Array Item using $set update operator" width="739" height="469" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-update-mongodb-item-set-operator-300x190.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a><p id="caption-attachment-962" class="wp-caption-text">SSIS MongoDB Destination &#8211; Update MongoDB Array Item using $set update operator</p></div>
<h2>Insert MongoDB Array Item ($push / $addToSet Operator)</h2>
<p>Now lets look at how to insert new item into existing Array. Lets say we already have two orders for a customer and now we want to add new order. For this you can either use  <a href="https://docs.mongodb.com/manual/reference/operator/update/push/" target="_blank" rel="noopener">$push operator</a> or <a href="https://docs.mongodb.com/manual/reference/operator/update/addToSet/" target="_blank" rel="noopener">$addToSet operator</a>. $push operator doesn&#8217;t check for duplicate item so its little faster. If you wish to skip append if item already exists (by matching all attributes) then use $addToSet operator.</p>
<h3>Using Shell Command : Insert MongoDB Array Item (Append to array)</h3>
<p>Here is the shell command which will push new item to the array</p><pre class="crayon-plain-tag">db.MyCollection.update(
	{CustomerID:"BOLID"},
	{$push:{Orders: {"OrderID":202,"ShipCountry":"USA","ShipCity":"Atlanta" } }},
	{upsert: false,multi: false}
)</pre><p>
&nbsp;</p>
<h3>Using Shell Command : Insert MongoDB Array Item at second level</h3>
<p>Here is the shell command which will push new item to the array which is stored at second level e.g. { Orders :  [ { Items : [ insert-here ] } ] }</p><pre class="crayon-plain-tag">db.MyCollection.update(
	{CustomerID:"BOLID", "Orders.OrderID" : 202 },
	{$push:{ "Orders.$.Items" : {"ProductID":1001,"Quantity":3} } },
	{upsert: false,multi: false}
)</pre><p>
<h3>Using SSIS : Insert MongoDB Array Item at Second Level</h3>
<p>Now lets look at some example how to Insert Items inside Orders array. Since it requires two JOIN columns to perform second level array insert you may need to add metadata for join.</p>
<p>First step is create documents for update. There are atleast 4 ways you can create input documents for MongoDB Destination.</p>
<ol>
<li>You can use <a href="//zappysys.com/blog/create-mongodb-documents-ssis-json-bson-load-update-insert-upsert-collection/" target="_blank" rel="noopener">JSON generator Transform to create documents for load process</a></li>
<li>You can use <a href="//zappysys.com/blog/export-json-from-sql-server-using-ssis/" target="_blank" rel="noopener">Export JSON Task to generate input documents</a> file and then use JSON Source to Read Documents (Check Output as Document option on JSON Source to read as RAW JSON)</li>
<li>You can use JSON Source to feed direct JSON (This approach is demonstrated in the below example sceenshot)</li>
<li>You can also use SQL query to output JSON Strings along with columns used for JOIN condition<br />
<pre class="crayon-plain-tag">select CustomerID, OrderID as 'Orders.$.OrderID', DOC = '{Orders.$.Items : {ItemID: 1, Qty: 5} }'</pre>
</li>
</ol>
<p>To make it simple lets use #3 approach from above list. We will create few documents and insert New orders Items</p>
<h4>Sample Document for MongoDB Collection</h4>
<p>For testing purpose you can create MongoDB collection called test with following one document. As you see Items array is empty for both orders but once you run sample each will have 2 items.</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("58c01bee0610fea8ddda04b9"),
    "CustomerID" : "ALFKI",
    "Orders" : [ 
        {
            "OrderID" : 100,
            "Items" : [ ]
        }, 
        {
            "OrderID" : 101,
            "Items" : [ ]
        }
    ]
}</pre><p>
Now lets look at how to configure SSIS package</p>
<p>&nbsp;</p>
<h4>Step-1 : Create JSON Documents for Array Insert</h4>
<p>Lets use JSON Source like below. Use following Sample JSON</p><pre class="crayon-plain-tag">/*Insert new items into order#100*/
{CustomerID:"ALFKI","Orders.$.OrderID" : 100, Doc: "{ \"Orders.$.Items\" : {ItemID: 1, Qty: 10} }" }
{CustomerID:"ALFKI","Orders.$.OrderID" : 100, Doc: "{ \"Orders.$.Items\" : {ItemID: 2, Qty: 11} }" }

/*Insert new items into order#101*/
{CustomerID:"ALFKI","Orders.$.OrderID" : 101, Doc: "{ \"Orders.$.Items\" : {ItemID: 1, Qty: 20} }" }
{CustomerID:"ALFKI","Orders.$.OrderID" : 101, Doc: "{ \"Orders.$.Items\" : {ItemID: 2, Qty: 21} }" }</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<div id="attachment_1064" style="width: 990px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1064" class="size-full wp-image-1064" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd.png" alt="Create Sample JSON Documents for MongoDB Array Update (2nd level array)" width="980" height="744" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd.png 980w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-second-level-array-update-push-insert-items-2nd-300x228.png 300w" sizes="(max-width: 980px) 100vw, 980px" /></a><p id="caption-attachment-1064" class="wp-caption-text">Create Sample JSON Documents for MongoDB Array Update (2nd level array)</p></div>
<h4>Step-2 : Configure MongoDB Destination for $push operation on Second level Array</h4>
<p>Now lets connect source to Destination and configure MongoDB Destination. Select connection on first tab. Then On second tab change properties like below.</p>
<p>&nbsp;</p>
<div id="attachment_1065" style="width: 620px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push-.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1065" class="size-full wp-image-1065" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push-.png" alt="Configure MongoDB Destination for second level array update (Insert item using $push update operator)" width="610" height="608" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push-.png 610w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push--150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-second-level-array-update-push--300x300.png 300w" sizes="(max-width: 610px) 100vw, 610px" /></a><p id="caption-attachment-1065" class="wp-caption-text">Configure MongoDB Destination for second level array update (Insert item using $push update operator)</p></div>
<h4>Step-3 : Add missing JOIN column for Mapping</h4>
<p>When you click on Mappings tab you will notice only root level columns are listed there for mapping but if you are JOINing based on Nested column found inside array then you have to add missing mapping column by hand like below screenshot.  In our case we Join by CustomerID and OrderID where OrderID is found in Orders array which is missing on mappings tab. So lets add it. Just make sure name new column using $ positional operator&#8230; e.g. Orders.$.OrderID  this will tell MongoDB that our OrderID column must be lookup under Array called Orders: [  ]
<div id="attachment_1066" style="width: 696px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1066" class="size-full wp-image-1066" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit.png" alt="MongoDB Destination - Add missing metadata column for JOIN " width="686" height="694" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit.png 686w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-add-missing-columns-metadata-edit-297x300.png 297w" sizes="(max-width: 686px) 100vw, 686px" /></a><p id="caption-attachment-1066" class="wp-caption-text">MongoDB Destination &#8211; Add missing metadata column for JOIN</p></div>
<h4>Step-4 : Map JOIN columns and Input DOCUMENT</h4>
<p>Now finally map all columns</p>
<div id="attachment_1067" style="width: 641px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1067" class="size-full wp-image-1067" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push.png" alt="SSIS MongoDB Destination - Column Mappings" width="631" height="742" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push.png 631w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-configure-mappings-second-level-array-update-push-255x300.png 255w" sizes="(max-width: 631px) 100vw, 631px" /></a><p id="caption-attachment-1067" class="wp-caption-text">SSIS MongoDB Destination &#8211; Column Mappings</p></div>
<h3>Using SSIS : Insert MongoDB Array Item (Append to array)</h3>
<p>Now lets look at how to perform same operation to insert array item in SSIS using $push operator. In this case we will do little different than Update Item example ($set operator). First we have not included CustomerID as part of Input columns and we mapped it on Mapping Screen rather than supplying columns names in ColumnsForLookup property (On Component Properties Tab of Destination UI). If you are using JSON Generator Transform to generate your JSON then you have option to Hide/Include certain columns part of your flow. Check Include column to downstream option if you want to use for JOIN column.</p>
<p>Set following settings</p>
<ul>
<li>Set LoadOptions as below<br />
<strong>op=$push;multi=true</strong></li>
<li>Set Operation=Update</li>
<li>Leave ColumnsForLookup as empty</li>
<li>On the mappings tab map __DOCUMENT__ and CustomerID in the Target. If you don&#8217;t see CustomerID column in the mapping create atleast one sample doc in MongoDB Collection so metadata is detected.</li>
</ul>
<p>Download Sample for more detail.</p>
<div id="attachment_966" style="width: 958px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-966" class="size-full wp-image-966" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert.png" alt="SSIS JSON Source - generate JSON for MongoDB Array Insert" width="948" height="516" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert.png 948w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-json-source-generate-json-for-mongodb-array-item-insert-300x163.png 300w" sizes="(max-width: 948px) 100vw, 948px" /></a><p id="caption-attachment-966" class="wp-caption-text">SSIS JSON Source &#8211; generate JSON for MongoDB Array Insert</p></div>
<div id="attachment_968" style="width: 684px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-968" class="size-full wp-image-968" src="//zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator.png" alt="SSIS MongoDB Destination - Insert MongoDB Array Item (Use $push, or $addToSet operator)" width="674" height="436" srcset="https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator.png 674w, https://zappysys.com/blog/wp-content/uploads/2017/01/ssis-mongodb-destination-insert-array-item-push-addtoset-operator-300x194.png 300w" sizes="(max-width: 674px) 100vw, 674px" /></a><p id="caption-attachment-968" class="wp-caption-text">SSIS MongoDB Destination &#8211; Insert MongoDB Array Item (Use $push, or $addToSet operator)</p></div>
<h2>Delete MongoDB Array Item ($pull operator)</h2>
<p>If you wish to remove array item then you can use <a href="https://docs.mongodb.com/manual/reference/operator/update/pull/" target="_blank" rel="noopener">$pull operator</a>. Only difference is rather than specifying two conditions in first argument&#8230; you just specify JOIN columns without array column (i.e. OrderID). To specify Array item condition you have to set inside $pull : { &#8230; }</p>
<h3>Using Shell Command for MongoDB Delete Array Item (Remove by condition)</h3>
<p>Below example shows how to remove OrderID=201 from Orders array for CustomerID=BOLID.</p><pre class="crayon-plain-tag">db.MyCollection.update(
	{CustomerID:"BOLID"},
	{$pull:{Orders: {"OrderID":201} }},
	{upsert: false,multi: false}
)</pre><p>
&nbsp;</p>
<h3>Using SSIS for MongoDB Delete Array Item</h3>
<p>Now lets look at how to implement Delete logic for MongoDB Array Item in SSIS. As you see in below screenshots You have to modify following things</p>
<ul>
<li>Set ColumnsForLookup property to CustomerID (no need to add OrderID here because its part of input document)</li>
<li>Set LoadOptions property to op=none;multi=false. op=none means we are supplying Update operator part of input document.</li>
</ul>
<p>Assume you have doc like below in MongoDB  and you like to remove Order#101 from array</p><pre class="crayon-plain-tag">{
    "_id" : ObjectId("58c01bee0610fea8ddda04b9"),
    "ParentID" : 1,
    "Orders" : [ 
        100, 
        101, 
        102
    ]
}</pre><p>
For this supply 2 columns from upstream<br />
col1  = ParentID<br />
col2  = DOCUMENT</p>
<p>Document column should look like below<br />
{Orders: 101}</p>
<ol>
<li>On MongoDB destination change LoadOptions property to  op=$pull;multi=true</li>
<li>Change Operation to Update</li>
<li>Map ParentID and DOCUMENT columns on Mapping screen</li>
<li>Run the package &#8230; It will remove Order# 101 from array</li>
</ol>
<h2>Array Upsert &#8211; Update / Insert using Custom JOIN condition (such as $ne )</h2>
<p>If you like to perform Upsert Operation on MongoDB Array Items then refer to below blog post.</p>
<blockquote class="wp-embedded-content" data-secret="kVibThe8Ux"><p><a href="https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/">Update or Insert &#8211; Upsert MongoDB Array Items using SSIS</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://zappysys.com/blog/update-insert-upsert-mongodb-array-items-ssis/embed/#?secret=kVibThe8Ux" data-secret="kVibThe8Ux" width="600" height="338" title="&#8220;Update or Insert &#8211; Upsert MongoDB Array Items using SSIS&#8221; &#8212; ZappySys Blog" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>MongoDB integration can be challenging if you are new to NoSQL world. If you are using SSIS as your primary ETL tool then not to worry because <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> can give super power needed to complete your project on time with drag and drop high performance connectors.</p>
<p>Keywords: mongodb update array item | mongodb update array elements | mongodb update array documents | MongoDB $ operator | MongoDB update sub document items | MongoDB CRUD operations | MongoDB Bulk Updates | MongoDB bulk updates to array items</p>
<p>The post <a href="https://zappysys.com/blog/update-mongodb-array-items-using-ssis/">Update MongoDB Array Items using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to call MongoDB JavaScript using SSIS</title>
		<link>https://zappysys.com/blog/call-mongodb-javascript-using-ssis-execute-sql-task/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 14 Oct 2016 17:31:25 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[runcommand]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=811</guid>

					<description><![CDATA[<p>Introduction SSIS PowerPack comes with great features for MongoDB Integration Scenarios but in this post we will focus on how to call MongoDB Javascript (Server side) using SSIS. For this purpose we will use SSIS MongoDB Execute SQL Task This powerful task not only easy to use but it supports calling any valid MongoDB commands [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/call-mongodb-javascript-using-ssis-execute-sql-task/">How to call MongoDB JavaScript using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img loading="lazy" decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" /><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> comes with great features for <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-integration-pack/" target="_blank" rel="noopener">MongoDB Integration Scenarios</a> but in this post we will focus on how to <em>call MongoDB Javascript</em> (Server side) using SSIS. For this purpose we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">SSIS MongoDB Execute SQL Task</a></p>
<p>This powerful task not only easy to use but it supports calling any valid MongoDB commands including <em>Server side Java Script</em>.</p>
<div class="su-note"  style="border-color:#e5e54c;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFFF66;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong> NOTE:</strong> ZappySys could not support $eval function, If you&#8217;ve installed MongoDB version higher than 3.0 version as MongoDB have removed support for the $eval function from version 4.2.<br />
If you still want to use $eval function then you need to downgrade MongoDB to a lower than 4.2 version.<br />
Please Refer to <a href="https://docs.mongodb.com/manual/release-notes/4.2-compatibility/#remove-support-for-the-eval-command" target="_blank" rel="noopener">MongoDB Release Notes</a> for reference. </div></div>
<h2>How to call MongoDB JavaScript &#8211; Example</h2>
<p>To call various MongoDB shell commands or <em>execute JavaScript in MongoDB</em> using SSIS you have Download and Install <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> . Once its installed perform following steps.</p>
<ol>
<li>From SSIS Toolbox drag ZS MongoDB ExecuteSQL Task</li>
<li>Click New to create new MongoDB connection manager</li>
<li>Once connection is configured click Test and OK to save</li>
<li>Now you can use {{Examples}} dropdown to see possible scenarios with MongoDB ExecuteSQL task</li>
<li>Below is sample script to call Aggregate command</li>
</ol>
<p><strong> NOTE:</strong> See how we returned command output using <strong>toArray()</strong> Javascript function at the end? This will give us all records in clean JSON Array format which can be consumed easily using <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">SSIS JSON Source.</a> If you don&#8217;t use toArray then you may get Cursor with only first batch.</p>
<div class="su-note"  style="border-color:#e5e54c;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFFF66;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">ZappySys MongoDB Shell command syntax (i.e. JSON) supports both double quotes and single quotes around the property name or value (i.e. your script). If you wrap your code with single quote then do not use single quote inside script block. </div></div>
<pre class="crayon-plain-tag">{
scope: 'database',
db: '{{User::varDB}}',
command: 'eval',
args: 
 { 
  code : 'function()
  {
   var varState="GA"
   return db.zipcodes.aggregate( 
   [
   {$match : { state: varState } },
   {$group : {_id :  "$state", TotalPopulation: { $sum: "$pop" }}},
   {$match: { TotalPopulation: { $gt: 25 } } },
   {$project : { StateAbbr: "$_id" , _id: 0, TotalPopulation:1 } },
   {$sort : {TotalPopulation : -1}}
   ]).toArray(); 
  }'
 }
}</pre>
<h2>Call MongoDB single line commands</h2>
<p>If you wish to call commands which are single line only then you may use below code which is simpler than previous example. Notice it doesn&#8217;t require function() keyword like previous one. Make sure your code has to be in single line or try to use \r\n for new line</p><pre class="crayon-plain-tag">{
 scope: 'database',
 command: 'eval',
 args: { code: 'db.hostInfo()' } 
}</pre><p>
<h2>Permissions needed to call JavaScript</h2>
<p>Calling eval command requires special permission so make sure you setup permission so MongoDB user can call db.runCommand ( {eval command} ). Here is more information about <a href="https://docs.mongodb.com/manual/reference/command/eval/" target="_blank" rel="noopener">calling eval command in MongoDB</a>.</p>
<h2>Save Result JSON of MongoDB command into SSIS variable</h2>
<p>If you want to save MongoDB command output as JSON into SSIS Variable then set Result mode = RawResult</p>
<div id="attachment_816" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-json-raw-result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-816" class="wp-image-816" src="//zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-json-raw-result.png" alt="Call MongoDB JavaScript in SSIS Using Execute SQL Task - Aggregate Command Example - Save raw JSON output into SSIS variable" width="600" height="554" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-json-raw-result.png 794w, https://zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-json-raw-result-300x277.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-816" class="wp-caption-text">Call MongoDB JavaScript in SSIS Using Execute SQL Task &#8211; Aggregate Command Example &#8211; Save raw JSON output into SSIS variable</p></div>
<h2>How to use MongoDB Eval command to call runCommand function</h2>
<p>Now lets look at how to call some admin functions using runCommand function. In below example we setting Global Timeout setting for Cursor (This helps to avoid timeout for long running cursor query)</p><pre class="crayon-plain-tag">{
 scope: 'database',
 command: 'eval',
 args: { code: "db.getSiblingDB('admin').runCommand( { setParameter: 1, cursorTimeoutMillis: 400000 } )" } 
}</pre><p>
<div id="attachment_1169" style="width: 1089px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-mongodb-setparameter-cursor-timeout.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1169" class="size-full wp-image-1169" src="//zappysys.com/blog/wp-content/uploads/2016/10/ssis-mongodb-setparameter-cursor-timeout.png" alt="Setting MongoDB Cursor Timeout ( set cursorTimeoutMillis parameter )" width="1079" height="685" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-mongodb-setparameter-cursor-timeout.png 1079w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-mongodb-setparameter-cursor-timeout-300x190.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/10/ssis-mongodb-setparameter-cursor-timeout-1024x650.png 1024w" sizes="(max-width: 1079px) 100vw, 1079px" /></a><p id="caption-attachment-1169" class="wp-caption-text">Setting MongoDB Cursor Timeout ( set cursorTimeoutMillis parameter )</p></div>
<p>&nbsp;</p>
<h2>Save Result of MongoDB command into SSIS variable as ADO.net Table</h2>
<p>If you want to use ForEach Loop to iterate through certain records from MongoDB result then set Result mode = FullResult this will save result as ADO.net table rather than JSON. Example : Get all collections and loop through them in SSIS using ForEachLoop Task?</p>
<div id="attachment_817" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-full-result.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-817" class="wp-image-817" src="//zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-full-result.png" alt="Call MongoDB JavaScript in SSIS - Aggregate Command - Save JSON output as ADO.net Table - Loop Through ForEachLoop" width="600" height="547" srcset="https://zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-full-result.png 798w, https://zappysys.com/blog/wp-content/uploads/2016/10/call-mongodb-javascript-ssis-execute-sql-task-save-full-result-300x274.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-817" class="wp-caption-text">Call MongoDB JavaScript in SSIS &#8211; Aggregate Command &#8211; Save JSON output as ADO.net Table &#8211; Loop Through ForEachLoop</p></div>
<h2>Conclusion</h2>
<p>MongoDB is the most popular NoSQL Database engine but integrating that into SSIS can be challenging without right tools. ZappySys SSIS PowerPack comes with many <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-integration-pack/" target="_blank" rel="noopener">MongoDB Tasks/Components for SSIS</a>.</p>
<p>The post <a href="https://zappysys.com/blog/call-mongodb-javascript-using-ssis-execute-sql-task/">How to call MongoDB JavaScript using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Insert Multiple Documents into MongoDB using SSIS</title>
		<link>https://zappysys.com/blog/insert-multiple-documents-mongodb-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 28 Jun 2016 00:55:05 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<category><![CDATA[BSON]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS MongoDB ExecuteSQL Task]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=634</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to use MongoDB ExecuteSQL Task for SSIS to insert multiple documents into MongoDB collection using SSIS. This task can be used to perform any DDL or DML operations for MongoDB natively inside SSIS without using any command line utilities. It gives you flexibility and security of SSIS. [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/insert-multiple-documents-mongodb-using-ssis/">How to Insert Multiple Documents into MongoDB using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img loading="lazy" decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" />In this post you will learn how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL Task for SSIS</a> to <em>insert multiple documents into MongoDB collection</em> using SSIS. This task can be used to perform any DDL or DML operations for MongoDB natively inside SSIS without using any command line utilities. It gives you flexibility and security of SSIS.</p>
<p>&nbsp;</p>
<h2>Step-By-Step &#8211; Insert Multiple Documents into MongoDB Collection using SSIS</h2>
<p>Lets look at how to insert multiple MongoDB documents into</p>
<ol>
<li>Download SSIS PowerPack from here</li>
<li>Create new SSIS Package</li>
<li>Drag ZS MongoDB ExecuteSQL Task from SSIS Toolbox</li>
<li>Double click task to configure</li>
<li>Create new MongoDB connection by clicking on [New] button next to connection dropdown</li>
<li>Click OK to close connection UI</li>
<li>Now you can enter following Command in MongoDB ExecuteSQL Task to insert multiple documents into MongoDB. If you want to pass json stored inside SSIS variable then use variable placeholders (e.g. {{User::varMyJson}}  ) anywhere inside below command.<br />
<pre class="crayon-plain-tag">{
 scope: 'database',
 db: 'DemoDB',
 command: 'eval',
 args: { code: 'db.MyCollection.insert( [ {ID:1,Name:"AAA"}, {ID:2,Name:"BBB"} ] )' } 
}</pre>
</li>
</ol>
<div id="attachment_686" style="width: 814px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-686" class="size-full wp-image-686" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json.png" alt="Insert multiple documents in MongoDB Collection (JSON or BSON format)" width="804" height="567" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json.png 804w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-insert-multiple-documents-in-mongodb-collection-json-300x212.png 300w" sizes="(max-width: 804px) 100vw, 804px" /></a><p id="caption-attachment-686" class="wp-caption-text">Insert multiple documents in MongoDB Collection (JSON or BSON format)</p></div>
<h2>Conclusion</h2>
<p>Using <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL Task for SSIS</a> you can execute ad-hoc MongoDB Shell commands without installing any command line tools. This is totally native SSIS approaching. You can Try <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack for FREE</a> to find out many more MongoDB features not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/insert-multiple-documents-mongodb-using-ssis/">How to Insert Multiple Documents into MongoDB using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to add / remove MongoDB User in SSIS</title>
		<link>https://zappysys.com/blog/add-remove-mongodb-user-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 16 Jun 2016 21:45:30 +0000</pubDate>
				<category><![CDATA[SSIS MongoDB ExecuteSQL]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongoDB ExecuteSQL Task]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=604</guid>

					<description><![CDATA[<p>Introduction In this blog post, you will learn how to call MongoDB Shell Commands from SSIS using the MongoDB ExecuteSQL task Some use cases for calling MongoDB shell commands are listed here. &#160; How to call MongoDB Shell Commands in SSIS Download and install SSIS PowerPack from here From the toolbox of the SSIS designer, [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/add-remove-mongodb-user-ssis/">How to add / remove MongoDB User in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img loading="lazy" decoding="async" class="size-full wp-image-2115 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/08/mongodb-logo.png" alt="" width="88" height="88" />In this blog post, you will learn how to call MongoDB Shell Commands from SSIS using the <a href="//zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL task</a></p>
<p>Some use cases for calling <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-mongodb-executesql-task.htm#A_Examples" target="_blank" rel="noopener">MongoDB shell commands are listed here</a>.</p>
<p>&nbsp;</p>
<h2>How to call MongoDB Shell Commands in SSIS</h2>
<ol>
<li>Download and install <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here</a></li>
<li>From the toolbox of the SSIS designer, drag  <a href="//zappysys.com///zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">ZS MongoDB ExecuteSQL Task</a></li>
<li>Click on New Connection (Next to the connection dropdown)</li>
<li>Configure the MongoDB connection and click Test. Close UI by clicking OK</li>
<li>Now, on the Task UI, configure it as below. Notice the &#8220;Examples&#8221; dropdown. That&#8217;s the best way to learn various commands.</li>
<li>You can also use the &#8220;Insert Variables&#8221; option to make your command dynamic (Read value from SSIS variable)
<div id="attachment_11590" style="width: 969px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/06/How-to-add-remove-MongoDB-User-in-SSIS.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11590" class="size-full wp-image-11590" src="https://zappysys.com/blog/wp-content/uploads/2016/06/How-to-add-remove-MongoDB-User-in-SSIS.png" alt="" width="959" height="575" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/How-to-add-remove-MongoDB-User-in-SSIS.png 959w, https://zappysys.com/blog/wp-content/uploads/2016/06/How-to-add-remove-MongoDB-User-in-SSIS-300x180.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/06/How-to-add-remove-MongoDB-User-in-SSIS-768x460.png 768w" sizes="(max-width: 959px) 100vw, 959px" /></a><p id="caption-attachment-11590" class="wp-caption-text">How to add/remove a MongoDB User in SSIS</p></div></li>
</ol>
<div class="mceTemp"></div>
<h2>Add MongoDB User</h2>
<p>To add a MongoDB user using the <a href="//zappysys.com///zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL Task</a>, use the following Script</p><pre class="crayon-plain-tag">{
 scope: 'database',
 command: 'eval',
 db: 'Northwind',
 args: { code: 'db.createUser( { user: "myUser1", pwd: "password123",roles: [ "readWrite", "dbAdmin" ] })' }
}</pre><p>
&nbsp;</p>
<h2>Remove MongoDB User</h2>
<p>To remove the MongoDB user using the <a href="//zappysys.com///zappysys.com/products/ssis-powerpack/ssis-mongodb-executesql-task/" target="_blank" rel="noopener">MongoDB ExecuteSQL Task</a>, use the following Script</p><pre class="crayon-plain-tag">{
 scope: 'database',
 command: 'eval',
 db: 'Northwind',
 args: { code: 'db.removeUser("myUser1")' }
}</pre><p>
&nbsp;</p>
<h2>List MongoDB Users from the Command Line</h2>
<p>To list existing users for a specific database, perform the following steps.</p>
<ol>
<li>Open the command prompt and type <strong>mongo</strong></li>
<li>If needed, type userid/password (if not required, then do the next step)</li>
<li>type <strong>use YourDBName</strong></li>
<li>Type <strong>db.getUsers()</strong></li>
</ol>
<div id="attachment_605" style="width: 502px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-mongodb-list-database-users-command-line.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-605" class="size-full wp-image-605" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-mongodb-list-database-users-command-line.png" alt="How to list MongoDB dabase users using db.getUsers() on mongo command line" width="492" height="479" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-mongodb-list-database-users-command-line.png 492w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-mongodb-list-database-users-command-line-300x292.png 300w" sizes="(max-width: 492px) 100vw, 492px" /></a><p id="caption-attachment-605" class="wp-caption-text">How to list MongoDB database users using db.getUsers() on the mongo command line</p></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/add-remove-mongodb-user-ssis/">How to add / remove MongoDB User in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
