Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zleao/fe3c78b2dad1f098d13f1bb2e3af750b to your computer and use it in GitHub Desktop.
Save zleao/fe3c78b2dad1f098d13f1bb2e3af750b to your computer and use it in GitHub Desktop.
Code necessary to create a databse using the MongoDB.Driver
public IMongoDatabase GetDatabaseInstance()
{
var settings = MongoClientSettings.FromUrl(new MongoUrl(Configuration.ConnectionString));
settings.SslSettings = new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
var client = new MongoClient(settings);
return client.GetDatabase(Configuration.DatabaseName);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment