MongoUrl url = new MongoUrl(ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString);var client = new MongoClient(url);var db = client.GetDatabase(url.DatabaseName, null);
// now you can get collections from dbHi,
A couple of things:
admin database. Please see C#: get a database to switch using a different database. admin user. Please ensure you have the necessary roles/auth to write into the intended database/collection. Note that userAdminAnyDatabase does not have insert action. I would recommend to enrol in a free online course at MongoDB University to learn more about MongoDB. The next session for MongoDB C# Driver - M101N: MongoDB for .NET Developers starts on the 17th October.
Regards,
Wan.