How to connect Mongo DB with Uipath

Hello everyone,

I am having trouble connecting Mongo Db to my UiPath studio and was wondering if anyone knows how to do it. Could someone please help me out?

Also, just for your information, I have already referred to some documents regarding this issue, but I haven’t been able to find a solution yet.

  1. Uipath and MongoDB connectivity
  2. How to Connect MongoDB for Uipath Studio

Thank you.

Hi @shivam.kale - can you explain what kind of issue are you facing?

Based on your version and requirement you download custom activities from the market place

Method 1: Market place

Second approach

NOTE: GOT from Internet

Method 2: Using MongoDB C# Driver

  1. Install MongoDB Driver:

    • Open UiPath Studio.
    • Go to “Manage Packages” under the “Design” tab.
    • Search for “MongoDB.Driver” and install the latest compatible version.
  2. Use Invoke Code Activity:

    • Drag an “Invoke Code” activity into your workflow.
  3. Write C# Code for Connection:

    • Inside the “Invoke Code” activity, write the following C# code, replacing placeholders with your actual details:
    // Replace with your connection string
    var connectionString = "mongodb://your_mongodb_server:port/your_database";
    
    // Create a MongoClient instance
    var client = new MongoClient(connectionString);
    
    // Get a reference to the database
    var database = client.GetDatabase("your_database");
    
    // Get a reference to the collection
    var collection = database.GetCollection<BsonDocument>("your_collection");
    
    // Perform operations on the collection (e.g., insert, find, update, etc.)
    // ...
    
    • This code establishes a connection using the MongoClient class, retrieves the target database and collection, and opens the door for further operations.
  4. Handle Operations (Optional):

    • You can add additional code within the activity to perform CRUD (Create, Read, Update, Delete) operations on your MongoDB data using the collection object.

Method 3: Using CData MongoDB Source (Paid Option)

  1. Install CData MongoDB Source:

  2. Configure ODBC Data Source:

    • Create a new System DSN (Data Source Name) using the CData ODBC Administrator tool.
    • Configure the connection details pointing to your MongoDB server and database.
  3. Use Database Activity:

    • Drag a “Database Connect” activity into your workflow.
  4. Connect Using ODBC:

    • In the “Connection String” property, use the format DSN=YourODBCDSNName; where YourODBCDSNName is the name you assigned during configuration.
  5. Perform Operations:

    • Use the provided activities within the “Database” category to interact with your MongoDB data through the ODBC connection.