{"id":6346,"date":"2019-02-13T15:36:07","date_gmt":"2019-02-13T15:36:07","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=6346"},"modified":"2019-02-13T15:39:24","modified_gmt":"2019-02-13T15:39:24","slug":"update-insert-upsert-mongodb-array-items-ssis","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/","title":{"rendered":"Update or Insert &#8211; Upsert MongoDB Array Items using SSIS"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>In our previous blog post we saw how to <a href=\"https:\/\/zappysys.com\/blog\/update-mongodb-array-items-using-ssis\/\" target=\"_blank\" rel=\"noopener\">update \/ delete mongodb array item<\/a>. Now let&#8217;s look at how to Upsert MongoDB Array Items (i.e. Insert Item if not found in Array else Update existing record). Upsert into nested MongoDB Array requires two step process, unfortunately there is no easy way to do in a single step. You may see in below screenshot that first we will do Update Step for Existing MongoDB Array Items and then we will insert missing Records in second step. So let&#8217;s get started.<\/p>\n<div class=\"content_block\" id=\"custom_post_widget-2523\"><h2><span id=\"Prerequisites\">Prerequisites<\/span><\/h2>\r\nBefore we perform the steps listed in this article, you will need to make sure the following prerequisites are met:\r\n<ol style=\"margin-left: 1.5em;\">\r\n \t<li><abbr title=\"SQL Server Integration Services\">SSIS<\/abbr> designer installed.\u00a0Sometimes it is referred to as <abbr title=\"Business Intelligence Development Studio\">BIDS<\/abbr> or <abbr title=\"SQL Server Data Tools\">SSDT<\/abbr> (<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssdt\/download-sql-server-data-tools-ssdt\" target=\"_blank\" rel=\"noopener\">download it from the Microsoft site<\/a>).<\/li>\r\n \t<li>Basic knowledge of SSIS package\u00a0development using\u00a0<em>Microsoft SQL Server Integration Services<\/em>.<\/li>\r\n \t<li>Make sure\u00a0<span style=\"text-decoration: underline;\"><a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys SSIS PowerPack<\/a><\/span>\u00a0is installed (<a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/download\/\" target=\"_blank\" rel=\"noopener\">download it<\/a>, if you haven't already).<\/li>\r\n \t<li>(<em>Optional step<\/em>)<em>.<\/em>\u00a0<a href=\"https:\/\/zappysys.zendesk.com\/hc\/en-us\/articles\/360035974593\" target=\"_blank\" rel=\"noopener\">Read this article<\/a>, if you are planning to deploy packages to a server and schedule their execution later.<\/li>\r\n<\/ol><\/div>\n<h2>MongoDB Array Upsert &#8211; Update \/ Insert using Custom JOIN condition (such as $ne )<\/h2>\n<p>By default SSIS Mongodb Destination performs Lookup using $eq condition (Match rows using Equal operator). However there will be a time when you like to lookup and update target rows using custom join criteria (e.g. Use Not Equal condition &#8211; $ne ). V2.7.6\u00a0 and later introduced new property called\u00a0 <span class=\"lang:default decode:true crayon-inline \">EnableCustomLookupQuery<\/span>\u00a0. When you enable this setting, you can supply a document which contains Data and Condition. You can map this XML formatted document to\u00a0 \u00a0__DOCUMENT__\u00a0 (see below)<\/p>\n<p>Here is the description how to use custom Join using this new property.<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">Enables use of custom lookup query for Update \/ Upsert or Delete Operation. \r\nBy default JOIN condition for target record match is generated automatically based on columns you supply in ColumnsForLookup property. \r\nHowever in some cases you need to supply custom condition for lookup to perform complex operations, in such case enable this option. \r\nWhen you enable this option you must supply map __DOCUMENT__ input column. String you supply to this column should be in this format \r\n\r\n&lt;command&gt;\r\n  &lt;query&gt;YOUR_LOOKUP_QUERY&lt;\/query&gt;\r\n  &lt;document&gt;YOUR_JSON_DOC&lt;\/document&gt;\r\n&lt;\/command&gt;. \r\n\r\nLookup query in &lt;query&gt; tag can be either Mongo JSON format (e.g. { \\\"CustomerID\\\" : \\\"AAA\\\", \\\"Orders.OrderID\\\" : { \\\"$ne\\\" : \\\"1000\\\" } }) \r\nOR\r\nyou can use ZappySys SQL query (e.g. select * from mytable where CustomerID='AAA' and [Orders.$.OrderID] != '1000' )<\/pre>\n<p>Now lets look at step by step. In below example we have a table called CustomerTest. We will load it with 2 records (With No orders). Then Update array using custom lookup condition, and later step we will insert record in array using custom lookup condition.<\/p>\n<div id=\"attachment_6299\" style=\"width: 498px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6299\" class=\"size-full wp-image-6299\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png\" alt=\"SSIS MongoDB Array Upsert Example (Update \/ Insert Array Items based on custom lookup condition)\" width=\"488\" height=\"346\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png 488w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example-300x213.png 300w\" sizes=\"(max-width: 488px) 100vw, 488px\" \/><\/a><p id=\"caption-attachment-6299\" class=\"wp-caption-text\">SSIS MongoDB Array Upsert Example (Update \/ Insert Array Items based on custom lookup condition)<\/p><\/div>\n<h3>Update Array using Custom Lookup Condition<\/h3>\n<ol>\n<li>Lets create few sample rows in MongoDB Collection. You can use following command in SSIS MongoDB Execute SQL Task\n<pre class=\"lang:js decode:true\">{\r\n scope: 'database',\r\n db: 'Northwind',\r\n command: 'eval',\r\n args: \r\n {\r\n code: 'db.CustomerTest.insert( [ {CustomerID:\"AAA\", Orders:[]}, {CustomerID:\"BBB\", Orders:[]}, {CustomerID:\"CCC\", Orders:[{OrderID:\"1004\",\"OrderDate\" : \"2008-02-05\",\"Qty\" : \"5\"} ]} ] )' \r\n \r\n } \r\n}\r\n<\/pre>\n<\/li>\n<li>Now drag Data flow.<\/li>\n<li>Drag <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-csv-file-source-flat-file-web-api\/\" target=\"_blank\" rel=\"noopener\">ZS CSV Source<\/a> or any other source. For example purpose we will configure CSV Source using Direct Value option with following Sample data. In the first run of package it will update only orders for CCC customer because only that customer will have records after table creation. one row. But in 2nd run all rows updated.\n<pre class=\"lang:default highlight:0 decode:true\">CustomerID,Company,OrderID,OrderDate,Qty,Address\r\nAAA,Anthony Inc,1000,2008-01-01,90,Po Box 111\\4612\r\nAAA,Anthony Inc,1001,2010-02-01,91,Po Box 111 \/ 4612\r\nBBB,Bob Inc,1002,2008-02-01,92,Po Box 222 \/ 4612\r\nBBB,Bob Inc,1003,2010-01-01,93,Po Box 222 \/ 4612\r\nCCC,Cindy Inc,1004,2010-01-07,2,Po Box 555 \/ 2345<\/pre>\n<p>&nbsp;<\/li>\n<li>Click OK to save Source UI<\/li>\n<li>Now drag ZS Template Transform to build XML document (Data + Query). Connect Source to Template transform. You can also use ZS XML Generator Transform but for simplicity we will use Template Transform.<\/li>\n<li>Double click to open Template Transform and enter text as below. Notice how we have entered MongoDB Query and Data in two separate XML nodes. First node is custom query for lookup. Second node is Operation we like to perform (e.g. $set in our case to update existing data). You can use Insert Variable and then select Columns option to insert placeholders. Also in some fields we used JSONENCODE function to make sure we escape double quote and slash correctly.\n<pre class=\"lang:js decode:true\">&lt;command&gt;\r\n\t&lt;query&gt;&lt;![CDATA[\r\n{\r\n\t\"CustomerID\": \"&lt;%CustomerID%&gt;\", \r\n\t\"Orders.OrderID\": { \"$eq\" : \"&lt;%OrderID%&gt;\"}\r\n}\r\n]]&gt;&lt;\/query&gt;\r\n\t&lt;document&gt;&lt;![CDATA[\r\n{\r\n  $set :\r\n   { \"CompanyName\":\"&lt;%Company,JSONENCODE%&gt;\", \r\n     \"Address\":\"&lt;%Address,JSONENCODE%&gt;\", \r\n     \"Orders.$.OrderID\": \"&lt;%OrderID%&gt;\", \r\n     \"Orders.$.OrderDate\": \"&lt;%OrderDate%&gt;\", \r\n     \"Orders.$.Qty\": \"&lt;%Qty%&gt;\" \r\n    } \r\n  }\r\n}\r\n]]&gt;&lt;\/document&gt;\r\n&lt;\/command&gt;<\/pre>\n<div id=\"attachment_6300\" style=\"width: 851px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-lookup-template-transform.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6300\" class=\"size-full wp-image-6300\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-lookup-template-transform.png\" alt=\"Using ZS Template Transform to specify custom JOIN condition for MongoDB Update (Array Items)\" width=\"841\" height=\"697\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-lookup-template-transform.png 841w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-lookup-template-transform-300x249.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-lookup-template-transform-768x636.png 768w\" sizes=\"(max-width: 841px) 100vw, 841px\" \/><\/a><p id=\"caption-attachment-6300\" class=\"wp-caption-text\">Using ZS Template Transform to specify custom JOIN condition for MongoDB Update (Array Items)<\/p><\/div><\/li>\n<li>Click OK to save Template Transform<\/li>\n<li>Drag ZS MongoDB Destination. Connect Template Transform to Destination<\/li>\n<li>Double click MongoDB Destination to edit. Set Connection, Table name, Operation=Update, <strong>EnableCustomLookupQuery<\/strong>=True\n<div id=\"attachment_6301\" style=\"width: 638px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-condition-setting.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6301\" class=\"size-full wp-image-6301\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-condition-setting.png\" alt=\"Configure MongoDB Destination for Custom Join Condition (EnableCustomLookupQuery Setting)\" width=\"628\" height=\"613\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-condition-setting.png 628w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-update-custom-condition-setting-300x293.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/a><p id=\"caption-attachment-6301\" class=\"wp-caption-text\">Configure MongoDB Destination for Custom Join Condition (EnableCustomLookupQuery Setting)<\/p><\/div><\/li>\n<li>Goto Mappings Tab and attach TemplateOutput to __DOCUMENT__\n<div id=\"attachment_6302\" style=\"width: 717px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-custom-join-mapping.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6302\" class=\"size-full wp-image-6302\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-custom-join-mapping.png\" alt=\"MongoDB Mappings - Loading Document for Array Update (Custom Join Criteria)\" width=\"707\" height=\"584\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-custom-join-mapping.png 707w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-custom-join-mapping-300x248.png 300w\" sizes=\"(max-width: 707px) 100vw, 707px\" \/><\/a><p id=\"caption-attachment-6302\" class=\"wp-caption-text\">MongoDB Mappings &#8211; Loading Document for Array Update (Custom Join Criteria)<\/p><\/div><\/li>\n<li>Click OK to Save<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h3>Insert into Array using Custom Lookup Condition<\/h3>\n<p>Now let&#8217;s look at slightly modified steps to Insert into Array for new records. In this example we will insert Source records if CustomerID found but OrderID is not found. (See Template Transform Step). We will use <strong>Not Equal Condition<\/strong> this time.<\/p>\n<ol>\n<li>Now drag Data flow rename it to something like <strong>[Add records to array]<\/strong><\/li>\n<li>Drag ZS CSV Source or any other source. For example purpose we will configure CSV Source using Direct Value option with following Sample data\n<pre class=\"lang:default highlight:0 decode:true\">CustomerID,Company,OrderID,OrderDate,Qty\r\nAAA,Anthony Inc,1000,2008-01-01,30\r\nAAA,Anthony Inc,1001,2010-02-01,4\r\nBBB,Bob Inc,1002,2008-02-01,30\r\nBBB,Bob Inc,1003,2010-01-01,4<\/pre>\n<p>&nbsp;<\/li>\n<li>Click OK to save Source UI<\/li>\n<li>Now drag ZS Template Transform to build XML document (Data + Query). Connect Source to Template transform. You can also use ZS XML Generator Transform but for simplicity we will use Template Transform.<\/li>\n<li>Double click to open Template Transform and enter text as below. Notice how we have entered MongoDB Query and Data in two separate XML nodes. First node is custom query for lookup. Second node is Operation we like to perform (e.g. $addToSet in our case to insert into array )\n<pre class=\"lang:js decode:true\">&lt;command&gt;\r\n&lt;query&gt;\r\n{\"CustomerID\": \"&lt;%CustomerID%&gt;\", \"Orders.OrderID\":{ \"$ne\" : \"&lt;%OrderID%&gt;\"}}\r\n&lt;\/query&gt;\r\n&lt;document&gt;{\r\n  $addToSet :\r\n   { Orders : {\"OrderID\": \"&lt;%OrderID%&gt;\", \"OrderDate\": \"&lt;%OrderDate%&gt;\", \"Qty\": \"&lt;%Qty%&gt;\" } }    \r\n }\r\n&lt;\/document&gt;\r\n&lt;\/command&gt;<\/pre>\n<\/li>\n<li>Click OK to save Template Transform<\/li>\n<li>Drag ZS MongoDB Destination. Connect Template Transform to Destination<\/li>\n<li>Double click MongoDB Destination to edit. Set Connection, Table name, Operation=Update, <strong>EnableCustomLookupQuery<\/strong>=True<\/li>\n<li>Goto Mappings Tab and attach TemplateOutput to __DOCUMENT__<\/li>\n<li>Click OK to Save<\/li>\n<\/ol>\n<p><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/MongoDB_Upsert_ArrayItem.zip\">Download Sample SSIS Package (2012 format) &#8211; MongoDB_Upsert_ArrayItem<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Conclusion<\/h2>\n<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>\n<p>Keywords: ssis mongodb upsert array item | ssis mongodb update array item | ssis mongodb update array elements | mongodb update array documents | MongoDB $set operator |\u00a0MongoDB $addToSet operator | MongoDB update sub document items | MongoDB CRUD operations | MongoDB Bulk Updates | MongoDB bulk updates to array items<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In our previous blog post we saw how to update \/ delete mongodb array item. Now let&#8217;s look at how to Upsert MongoDB Array Items (i.e. Insert Item if not found in Array else Update existing record). Upsert into nested MongoDB Array requires two step process, unfortunately there is no easy way to do [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6299,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80,267],"tags":[46,12,83],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Update or Insert - Upsert MongoDB Array Items using SSIS | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"Learn how to Upsert MongoDB Array Items in bulk (i.e. Insert if not found in array else Update existing record). Write custom Lookup and Join conditions.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Update or Insert - Upsert MongoDB Array Items using SSIS | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"Learn how to Upsert MongoDB Array Items in bulk (i.e. Insert if not found in array else Update existing record). Write custom Lookup and Join conditions.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ZappySys\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2019-02-13T15:36:07+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2019-02-13T15:39:24+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"488\" \/>\r\n\t<meta property=\"og:image:height\" content=\"346\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/zappysys\/\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/\",\"url\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/\",\"name\":\"Update or Insert - Upsert MongoDB Array Items using SSIS | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png\",\"datePublished\":\"2019-02-13T15:36:07+00:00\",\"dateModified\":\"2019-02-13T15:39:24+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82\"},\"description\":\"Learn how to Upsert MongoDB Array Items in bulk (i.e. Insert if not found in array else Update existing record). Write custom Lookup and Join conditions.\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png\",\"width\":488,\"height\":346,\"caption\":\"SSIS MongoDB Array Upsert Example (Update \/ Insert Array Items based on custom lookup condition)\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Update or Insert &#8211; Upsert MongoDB Array Items using SSIS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82\",\"name\":\"ZappySys\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g\",\"caption\":\"ZappySys\"},\"sameAs\":[\"http:\/\/www.zappysys.com\/\",\"https:\/\/www.facebook.com\/ZappySys\/\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/zappysys\/\"],\"url\":\"https:\/\/zappysys.com\/blog\/author\/admin\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Update or Insert - Upsert MongoDB Array Items using SSIS | ZappySys Blog","description":"Learn how to Upsert MongoDB Array Items in bulk (i.e. Insert if not found in array else Update existing record). Write custom Lookup and Join conditions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/","og_locale":"en_US","og_type":"article","og_title":"Update or Insert - Upsert MongoDB Array Items using SSIS | ZappySys Blog","og_description":"Learn how to Upsert MongoDB Array Items in bulk (i.e. Insert if not found in array else Update existing record). Write custom Lookup and Join conditions.","og_url":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/","og_site_name":"ZappySys Blog","article_author":"https:\/\/www.facebook.com\/ZappySys\/","article_published_time":"2019-02-13T15:36:07+00:00","article_modified_time":"2019-02-13T15:39:24+00:00","og_image":[{"width":488,"height":346,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png","type":"image\/png"}],"author":"ZappySys","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/zappysys\/","twitter_misc":{"Written by":"ZappySys","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/","url":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/","name":"Update or Insert - Upsert MongoDB Array Items using SSIS | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png","datePublished":"2019-02-13T15:36:07+00:00","dateModified":"2019-02-13T15:39:24+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82"},"description":"Learn how to Upsert MongoDB Array Items in bulk (i.e. Insert if not found in array else Update existing record). Write custom Lookup and Join conditions.","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/01\/ssis-mongodb-array-upsert-example.png","width":488,"height":346,"caption":"SSIS MongoDB Array Upsert Example (Update \/ Insert Array Items based on custom lookup condition)"},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/update-insert-upsert-mongodb-array-items-ssis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Update or Insert &#8211; Upsert MongoDB Array Items using SSIS"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82","name":"ZappySys","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g","caption":"ZappySys"},"sameAs":["http:\/\/www.zappysys.com\/","https:\/\/www.facebook.com\/ZappySys\/","https:\/\/twitter.com\/https:\/\/twitter.com\/zappysys\/"],"url":"https:\/\/zappysys.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/6346"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=6346"}],"version-history":[{"count":3,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/6346\/revisions"}],"predecessor-version":[{"id":6349,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/6346\/revisions\/6349"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/6299"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=6346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=6346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=6346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}