studio
latest
false
- Getting Started
- Setup and Configuration
- Automation Projects
- Dependencies
- Types of Workflows
- Control Flow
- File Comparison
- Automation Best Practices
- Source Control Integration
- Debugging
- Logging
- The Diagnostic Tool
- Workflow Analyzer
- About Workflow Analyzer
- ST-NMG-001 - Variables Naming Convention
- ST-NMG-002 - Arguments Naming Convention
- ST-NMG-004 - Display Name Duplication
- ST-NMG-005 - Variable Overrides Variable
- ST-NMG-006 - Variable Overrides Argument
- ST-NMG-008 - Variable Length Exceeded
- ST-NMG-009 - Prefix Datatable Variables
- ST-NMG-011 - Prefix Datatable Arguments
- ST-NMG-012 - Argument Default Values
- ST-NMG-016 - Argument Length Exceeded
- ST-NMG-017 - Class name matches default namespace
- ST-DBP-002 - High Arguments Count
- ST-DBP-003 - Empty Catch Block
- ST-DBP-007 - Multiple Flowchart Layers
- ST-DPB-010 - Multiple instances of [Workflow] or [Test Case]
- ST-DBP-020 - Undefined Output Properties
- ST-DBP-021 - Hardcoded Timeout
- ST-DBP-023 - Empty Workflow
- ST-DBP-024 - Persistence Activity Check
- ST-DBP-025 - Variables Serialization Prerequisite
- ST-DBP-027 - Persistence Best Practice
- ST-DBP-028 - Arguments Serialization Prerequisite
- ST-USG-005 - Hardcoded Activity Properties
- ST-USG-009 - Unused Variables
- ST-USG-010 - Unused Dependencies
- ST-USG-014 - Package Restrictions
- ST-USG-017 - Invalid parameter modifier
- ST-USG-020 - Minimum Log Messages
- ST-USG-024 - Unused Saved for Later
- ST-USG-025 - Saved Value Misuse
- ST-USG-026 - Activity Restrictions
- ST-USG-027 - Required Packages
- ST-USG-028 - Restrict Invoke File Templates
- ST-USG-032 - Required Tags
- ST-USG-034 - Automation Hub URL
- Variables
- Arguments
- Imported Namespaces
- Coded automations
- Introduction
- Registering custom services
- Before and After contexts
- Generating code
- Generating coded test case from manual test cases
- Troubleshooting
- Trigger-based Attended Automation
- Object Repository
- The ScreenScrapeJavaSupport Tool
- Extensions
- About extensions
- SetupExtensions tool
- UiPathRemoteRuntime.exe is not running in the remote session
- UiPath Remote Runtime blocks Citrix session from being closed
- UiPath Remote Runtime causes memory leak
- UiPath.UIAutomation.Activities package and UiPath Remote Runtime versions mismatch
- The required UiPath extension is not installed on the remote machine
- Screen resolution settings
- Group Policies
- Cannot communicate with the browser
- Chrome extension is removed automatically
- The extension may have been corrupted
- Check if the extension for Chrome is installed and enabled
- Check if ChromeNativeMessaging.exe is running
- Check if ComSpec variable is defined correctly
- Enable access to file URLs and Incognito mode
- Multiple browser profiles
- Group Policy conflict
- Known issues specific to MV3 extensions
- List of extensions for Chrome
- Chrome Extension on Mac
- Group Policies
- Cannot communicate with the browser
- Edge extension is removed automatically
- The extension may have been corrupted
- Check if the Extension for Microsoft Edge is installed and enabled
- Check if ChromeNativeMessaging.exe is running
- Check if ComSpec variable is defined correctly
- Enable access to file URLs and InPrivate mode
- Multiple browser profiles
- Group Policy conflict
- Known issues specific to MV3 extensions
- List of extensions for Edge
- Extension for Safari
- Extension for VMware Horizon
- Extension for Amazon WorkSpaces
- SAP Solution Manager plugin
- Excel Add-in
- Studio testing
- Troubleshooting
- About troubleshooting
- Assembly compilation errors
- Microsoft App-V support and limitations
- Internet Explorer X64 troubleshooting
- Microsoft Office issues
- Identifying UI elements in PDF with Accessibility options
- Repairing Active Accessibility support
- Validation of large Windows-legacy projects takes longer than expected

Studio User Guide
Last updated Nov 26, 2025
This tutorial shows how to connect to a MongoDB Atlas database from your UiPath coded automations. MongoDB Atlas is a fully-managed cloud database service that provides a reliable and scalable database solution without the need for local installations.
Here are the ways to implement the MongoDB connection code:
-
Copy and paste the code into a
CSfile of your target project. -
Use a custom activity package and the sample
NUPKGfile
When opting to use the sample
NUPKG file, you have the capability to add
the two-factor authentication as an activity within your XAML files.
Tip: Regardless of whether you choose to integrate the
MongoDB connection code in your CS files (for coded automations) or XAML files (for
low-code automations), remember that you can invoke a coded automation into a low-code one
and vice versa. For more information about hybrid automations, visit Creating hybrid automations - Combining Coded and Low-code Workflows.
- Ensure you have UiPath Studio (version 2024.10 or later - recommended).
- Ensure you have a MongoDB Atlas account.
- Install the
MongoDB.DriverNuGet package in your project.- Open your UiPath project in Studio.
- In the Design ribbon, go to Manage Packages.
- Select All Packages or the .NET tab.
- Search for
MongoDB.Driver. - Select
MongoDB.Driver, and then select Install. - Accept the license agreement and dependencies.
To use the MongoDB Atlas connection in your coded automation, you can copy and paste the
following sample code in a
CS file from your target project. Make sure the
namespace of the file matches with the one of your project name.
Note: The sample code connects to MongoDB Atlas using the connection
string format specific to cloud deployments. Make sure to replace the placeholder
credentials with your actual MongoDB Atlas credentials.
using System;
using System.Collections.Generic;
using System.Data;
using UiPath.CodedWorkflows;
using UiPath.Core;
using UiPath.Core.Activities.Storage;
using MongoDB.Driver;
namespace MongoDBCodedWorkflowsSample
{
public class TestConnection : CodedWorkflow
{
[Workflow]
public string Execute(string username, string password, string cluster)
{
List<string> databaseNames = new List<string>();
try
{
// Create MongoDB Atlas connection string
string connectionString = $"mongodb+srv://{username}:{password}@{cluster}/?retryWrites=true&w=majority";
Console.WriteLine("Connecting to MongoDB Atlas...");
// Initialize MongoDB client
var client = new MongoClient(connectionString);
// List all databases to verify connection
Console.WriteLine("\nAvailable databases:");
databaseNames = client.ListDatabaseNames().ToList();
foreach (var dbName in databaseNames)
{
Console.WriteLine($"- {dbName}");
}
Console.WriteLine("\nConnection successful!");
}
catch (MongoAuthenticationException authEx)
{
Console.WriteLine($"Authentication error: {authEx.Message}");
Console.WriteLine("Please verify your username and password.");
throw;
}
catch (MongoConnectionException connEx)
{
Console.WriteLine($"Connection error: {connEx.Message}");
Console.WriteLine("Please check your network access settings in MongoDB Atlas.");
throw;
}
catch (Exception ex)
{
Console.WriteLine($"MongoDB connection error: {ex.Message}");
throw;
}
return databaseNames;
}
}
}using System;
using System.Collections.Generic;
using System.Data;
using UiPath.CodedWorkflows;
using UiPath.Core;
using UiPath.Core.Activities.Storage;
using MongoDB.Driver;
namespace MongoDBCodedWorkflowsSample
{
public class TestConnection : CodedWorkflow
{
[Workflow]
public string Execute(string username, string password, string cluster)
{
List<string> databaseNames = new List<string>();
try
{
// Create MongoDB Atlas connection string
string connectionString = $"mongodb+srv://{username}:{password}@{cluster}/?retryWrites=true&w=majority";
Console.WriteLine("Connecting to MongoDB Atlas...");
// Initialize MongoDB client
var client = new MongoClient(connectionString);
// List all databases to verify connection
Console.WriteLine("\nAvailable databases:");
databaseNames = client.ListDatabaseNames().ToList();
foreach (var dbName in databaseNames)
{
Console.WriteLine($"- {dbName}");
}
Console.WriteLine("\nConnection successful!");
}
catch (MongoAuthenticationException authEx)
{
Console.WriteLine($"Authentication error: {authEx.Message}");
Console.WriteLine("Please verify your username and password.");
throw;
}
catch (MongoConnectionException connEx)
{
Console.WriteLine($"Connection error: {connEx.Message}");
Console.WriteLine("Please check your network access settings in MongoDB Atlas.");
throw;
}
catch (Exception ex)
{
Console.WriteLine($"MongoDB connection error: {ex.Message}");
throw;
}
return databaseNames;
}
}
}Connection Parameters
- username: The database user you created in MongoDB Atlas
- password: The password for your database user
- cluster: Your cluster hostname from the connection string (e.g.,
cluster0.abc123.mongodb.net)
The sample returns a list of all databases for that specific set of credentials.
Connection String Format - MongoDB Atlas uses the
mongodb+srv://
protocol, which:
- Automatically discovers all nodes in your cluster
- Provides automatic failover support
- Includes retry logic for write operations (
retryWrites=true) - Sets the write concern to majority (
w=majority)
Error Handling
- MongoAuthenticationException: Occurs when credentials are incorrect
- MongoConnectionException: Occurs when network access is blocked or cluster is unavailable
- General exceptions: Catches any other MongoDB-related errors
Using a sample
NUPKG file enables you to include the two-factor code in
your automations.
- Download the
NUPKGfile. - Upload the downloaded
NUPKGfile to your Orchestrator Host or Tenant feed, which are accessible through your Studio instance. For more information on uploading theNUPKGfile as a custom library to Orchestrator, refer to Manually uploading a library to Orchestrator. - Open your Studio project and open the Manage Packages menu.
- Search for the
MongoDB.Coded.Workflows.SampleNUPKGfile you previously saved to your Orchestrator Host or Orchestrator Tenant feed, and install it.Figure 1. Custom library in the Manage Packages menu
- After you install the file, navigate to the Activities panel and locate
MongoDB.Coded.Workflows.Sample. Drag and drop the GetDatabases activity into yourXAMLfiles to test your MongoDB connection and fetch a list of the available databases.Figure 2. GetDatabases activity in the Activities panel