You may use Invoke Code Activity
-
Add the MongoDb package.
MongoDB.Driver 2.11.2 -
Import the namespace.
-
You can use Invoke Code activity
-
Add the following C# code
var client = new MongoClient("<mongo-db-string>"); Console.WriteLine("Client"+client); // get the test database var db = client.GetDatabase("test"); Console.WriteLine("db"+db); // gets a collection named "foo" using a BsonDocument var collection = db.GetCollection<BsonDocument>("sample8"); Console.WriteLine("collection"+collection); var document = new BsonDocument("x", 1); collection.InsertOne(document);
Let me know. If the Invoke code errors out with CS1003. Just restart Studio and it should work as it reloads the libraries.