DEV Community

Discussion on: Tutorial: MongoDB With C# The Easy Way!

Collapse
 
reachej profile image
Erik • Edited

I'm trying to use MongoDB.Entities in Uipath Studio via the Invoke code activity. I was unable to get the connection initialized until I did this (the instructions are wrong on the website):

string connectionstring = "mongodb+srv://m220student:m220password@mflix.XXXXX.mongodb.net/mflix?retryWrites=true&w=majority";
Console.WriteLine("connection string :"+ connectionstring);
string databasename = "mflix";
DB.InitAsync(databasename,MongoClientSettings.FromConnectionString(connectionstring));
Console.WriteLine("initialized");

Now I'm trying to figure out how to select a database and create a document in a collection. In the invoke code activity in uipath, if you have the word await it won't compile and if you declare a class it won't compile.