How to Insert Multiple Documents into MongoDB using SSIS

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.

 

Step-By-Step – Insert Multiple Documents into MongoDB Collection using SSIS

Lets look at how to insert multiple MongoDB documents into

  1. Download SSIS PowerPack from here
  2. Create new SSIS Package
  3. Drag ZS MongoDB ExecuteSQL Task from SSIS Toolbox
  4. Double click task to configure
  5. Create new MongoDB connection by clicking on [New] button next to connection dropdown
  6. Click OK to close connection UI
  7. 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.
Insert multiple documents in MongoDB Collection (JSON or BSON format)

Insert multiple documents in MongoDB Collection (JSON or BSON format)

Conclusion

Using MongoDB ExecuteSQL Task for SSIS you can execute ad-hoc MongoDB Shell commands without installing any command line tools. This is totally native SSIS approaching. You can Try SSIS PowerPack for FREE to find out many more MongoDB features not discussed in this article.

Posted in SSIS MongoDB ExecuteSQL and tagged , , , , , , .