Since MongoDB Source supports only one output you cannot select two different hierarchies as your filter criteria. However solution is easy. You can perform following steps to achieve similar result without fetching data twice with multiple sources. Same steps described below can be applied for JSON Source (read more here)
Steps – Extract multiple arrays from MongoDB
- Extract data using MongoDB source (Select output mode as Raw Document)
- Connect MongoDB Source to Multicast Transform
- Connect multi cast output to JSON Parser Transform which will take upstream raw JSON doc and convert to Flat table output just like MongoDB source. On Json Parser specify filter e.g. $.doc.Array1[*]
- Connect Json Parser Transform output to desired target e.g. sql server/flat file.
- Repeat step #3,4,5 for as many outputs you need with different filter settings (e.g. $.doc.Array2[*]).
Here is more info about JSON Parser Transform (This is new Transform added in v2.2)
Video Tutorial – Step By Step – How to read multiple MongoDB arrays
Below video tutorial demonstrates following things
* How to execute MongoDB Shell commands in SSIS (e.g. create Collection)
* How to read data from multiple arrays from MongoDB document (i.e. Orders, Products)
* Save result into two SQL Server tables