Connect Uipath Studio to MongoDB

Hi,

Can anyone please tell how can i connect my UiPath Studio to Mongo DB…
Please tell me with the detailed steps.

Hi @sharali

Check the below documentation,

Hope it helps!!

What is DSN? How can I get the DSN

You may use Invoke Code Activity

  1. Add the MongoDb package.
    MongoDB.Driver 2.11.2
  2. Import the namespace.

  1. You can use Invoke Code activity
  2. 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);