SQLTeam.com | Weblogs | Forums

Mongodb connection in ssis script task c# coding


i have used following namespaces

using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Bson.Serialization;
//using MongoDB.Driver.Builders;
using MongoDB;

And my coding for connection is:

            var conString = "mongodb://xx.xx.x.xxx:27017";
            var Client = new MongoClient(conString);

            var DB = Client.GetDatabase("xxx");
            var collection = DB.GetCollection<BsonDocument>("frac_stage_data");

And when i run the script task with this coding alone,I am getting exception error:

Exception has been thrown by the target of an invocation.

need help to solve this error