Uipath and MongoDB connectivity

I want to connect Uipath with MongoDB. So I used connect activity for it. I mentioned connection string as “Dsn=mongoDb;uid=akshita;pwd=aksh45” and provider name as “System.Data.Odbc”.I have added the server name in control panel.And i have created cluster in mongoDB Atlas too. Still it is giving error as following:
Connect: ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).

You may use Invoke Code Activity

  1. Add the MongoDb package.
    MongoDB.Driver 2.11.2

  2. Import the namespace.

  3. You can use Invoke Code activity

  4. Add the following C# code

     var client = new MongoClient("<mongo-db-string>");
     // get the test database
     var db = client.GetDatabase("test");
     // gets a collection named "foo" using a BsonDocument
     var collection = db.GetCollection<BsonDocument>("sample8");
     var document = new BsonDocument("x", 1);

Let me know. If the Invoke code errors out with CS1003. Just restart Studio and it should work as it reloads the libraries.


I created this tutorial (also with video and example workflows):
Check it out, and hope it will help! Roman